基于CNN卷积神经网络的minst数据库手写字识别matlab仿真 |
您所在的位置:网站首页 › matlabttest › 基于CNN卷积神经网络的minst数据库手写字识别matlab仿真 |
1.算法描述 train-images-idx3-ubyte.gz,训练集,共 60,000 幅(28*28)的图像数据; train-labels-idx1-ubyte.gz,训练集的标签信息(取值为 0-9),60,000*1 t10k-images-idx3-ubyte.gz,测试集(t: test, 10k: 10,000),共 10,000 副(28*28)的图像数据 t10k-labels-idx1-ubyte.gz,测试集的标签呢信息(取值为 0-9),10,000*1
2.仿真效果预览 matlab2022a仿真结果如下:
3.MATLAB核心程序 load mnist_uint8; train_x = double(reshape(train_x',28,28,60000))/255; test_x = double(reshape(test_x',28,28,10000))/255; train_y = double(train_y'); test_y = double(test_y'); rand('state',0) cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer }; opts.alpha = 1; opts.batchsize = 50; opts.numepochs = 5; cnn = cnnsetup(cnn, train_x, train_y); cnn = cnntrain(cnn, train_x, train_y, opts); [er, bad] = cnntest(cnn, test_x, test_y) 1-er
|
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |