cifar10Data = tempdir;
url = 'https://www.cs.toronto.edu/~kriz/cifar-10-matlab.tar.gz';
helperCIFAR10Data.download(url,cifar10Data);
[trainingImages,trainingLabels,testImages,testLabels] = helperCIFAR10Data.load('cifar10Data');
size(trainingImages)
numImageCategories = 10;
categories(trainingLabels)
% Create the image input layer for 32x32x3 CIFAR-10 images
[height, width, numChannels, ~] = size(trainingImages);
imageSize = [height width numChannels];
inputLayer = imageInputLayer(imageSize);
% Convolutional layer parameters filter size
filterSize = [5 5];
numFilters = 32;
middleLayers = [
% The first convolutional layer has a bank of 32 5x5x3 filters. A
% symmetric padding of 2 pixels is added to ensure that image borders
% are included in the processing. This is important to avoid
% information at the borders being washed away too early in the
% network.
convolution2dLayer(filterSize, numFilters, 'Padding', 2) %(n+2p-f)/s+1
% Note that the third dimension of the filter can be omitted because it
% is automatically deduced based on the connectivity of the network. In
% this case because this layer follows the image layer, the third
% dimension must be 3 to match the number of channels in the input
% image.
% Next add the ReLU layer:
reluLayer()
% Follow it with a max pooling layer that has a 3x3 spatial pooling area
% and a stride of 2 pixels. This down-samples the data dimensions from
% 32x32 to 15x15.
maxPooling2dLayer(3, 'Stride', 2)
% Repeat the 3 core layers to complete the middle of the network.
convolution2dLayer(filterSize, numFilters, 'Padding', 2)
reluLayer()
maxPooling2dLayer(3, 'Stride',2)
convolution2dLayer(filterSize, 2 * numFilters, 'Padding', 2)
reluLayer()
maxPooling2dLayer(3, 'Stride',2)
];
finalLayers = [
% Add a fully connected layer with 64 output neurons. The output size of
% this layer will be an array with a length of 64.
fullyConnectedLayer(64)
% Add an ReLU non-linearity.
reluLayer
% Add the last fully connected layer. At this point, the network must
% produce 10 signals that can be used to measure whether the input image
% belongs to one category or another. This measurement is made using the
% subsequent loss layers.
fullyConnectedLayer(numImageCategories)
% Add the softmax loss layer and classification layer. The final layers use
% the output of the fully connected layer to compute the categorical
% probability distribution over the image classes. During the training
% process, all the network weights are tuned to minimize the loss over this
% categorical distribution.
softmaxLayer
classificationLayer
];
layers = [
inputLayer
middleLayers
finalLayers
];
layers(2).Weights = 0.0001 * randn([filterSize numChannels numFilters]);
% Set the network training options
opts = trainingOptions('sgdm', ...
'Momentum', 0.9, ...
'InitialLearnRate', 0.001, ...
'LearnRateSchedule', 'piecewise', ...
'LearnRateDropFactor', 0.1, ...
'LearnRateDropPeriod', 8, ...
'L2Regularization', 0.004, ...
'MaxEpochs', 40, ...
'MiniBatchSize', 128, ...
'Verbose', true);
% A trained network is loaded from disk to save time when running the
% example. Set this flag to true to train the network.
doTraining = false;
if doTraining
% Train a network.
cifar10Net = trainNetwork(trainingImages, trainingLabels, layers, opts);
else
% Load pre-trained detector for the example.
load('rcnnStopSigns.mat','cifar10Net')
end
% Extract the first convolutional layer weights
w = cifar10Net.Layers(2).Weights;
% rescale the weights to the range [0, 1] for better visualization
w = rescale(w);
figure
montage(w)
% Run the network on the test set.
YTest = classify(cifar10Net, testImages);
% Calculate the accuracy.
accuracy = sum(YTest == testLabels)/numel(testLabels)
没有合适的资源?快使用搜索试试~ 我知道了~
基于OCR的LSTM-CNN深度学习网络数字图片识别算法matlab仿真.zip
共458个文件
jpg:454个
m:2个
mat:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 9 浏览量
2022-11-01
16:54:41
上传
评论
收藏 654KB ZIP 举报
温馨提示
1.版本:matlab2019a,内含运行结果,不会运行可私信 2.领域:基础教程 3.内容: 4.适合人群:本科,硕士等教研学习使用
资源推荐
资源详情
资源评论
收起资源包目录
基于OCR的LSTM-CNN深度学习网络数字图片识别算法matlab仿真.zip (458个子文件)
运行结果.JPG 40KB
1.jpg 31KB
h5.jpg 11KB
h5.jpg 2KB
hw20.jpg 741B
8.jpg 741B
0.jpg 711B
0.jpg 709B
hw13.jpg 704B
hw10.jpg 703B
0.jpg 703B
8.jpg 702B
0.jpg 701B
hw19.jpg 700B
hw19.jpg 699B
0.jpg 696B
hw21.jpg 690B
8.jpg 685B
hw17.jpg 682B
0.jpg 681B
hw9.jpg 680B
8.jpg 679B
hw15.jpg 675B
hw13.jpg 675B
3.jpg 675B
5.jpg 675B
hw16.jpg 674B
8.jpg 673B
2.jpg 667B
hw16.jpg 664B
hw15.jpg 663B
8.jpg 663B
5.jpg 663B
0.jpg 663B
0.jpg 663B
hw16.jpg 662B
hw11.jpg 662B
4.jpg 662B
0.jpg 662B
hw3.jpg 661B
0.jpg 661B
hw12.jpg 660B
hw11.jpg 660B
2.jpg 660B
2.jpg 660B
hw7.jpg 659B
hw6.jpg 659B
2.jpg 659B
8.jpg 659B
hw21.jpg 658B
hw20.jpg 657B
hw19.jpg 657B
8.jpg 656B
hw7.jpg 655B
3.jpg 650B
hw20.jpg 649B
4.jpg 649B
0.jpg 649B
0.jpg 648B
5.jpg 648B
hw23.jpg 647B
hw17.jpg 647B
0.jpg 647B
3.jpg 647B
2.jpg 647B
hw4.jpg 646B
hw23.jpg 646B
0.jpg 646B
0.jpg 646B
5.jpg 645B
4.jpg 645B
hw6.jpg 644B
hw1.jpg 644B
hw8.jpg 644B
hw9.jpg 643B
hw6.jpg 643B
hw23.jpg 643B
hw5.jpg 642B
0.jpg 641B
4.jpg 640B
5.jpg 639B
2.jpg 637B
hw11.jpg 636B
hw15.jpg 636B
8.jpg 636B
hw23.jpg 635B
hw4.jpg 635B
hw4.jpg 634B
6.jpg 634B
3.jpg 634B
0.jpg 634B
hw8.jpg 633B
hw3.jpg 632B
2.jpg 632B
8.jpg 632B
hw12.jpg 631B
hw13.jpg 631B
hw17.jpg 631B
hw20.jpg 630B
0.jpg 630B
共 458 条
- 1
- 2
- 3
- 4
- 5
资源评论
- 陌紫2022-12-01资源很实用,对我启发很大,有很好的参考价值,内容详细。
天天Matlab科研工作室
- 粉丝: 3w+
- 资源: 7261
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 计算机视觉(CV)open CV 人脸识别程序.docx
- python 端午节游戏,选择三个传统的端午节活动之一:包粽子、赛龙舟或挂艾草 根据玩家的选择,游戏会描述相应的情节,并在完成后
- 数据库连接(MySQL与VS2022)_vs2022 mysql-CSDN博客 (2024_6_1 19_11_34).html
- 数电实验五:555单稳态触发电路、555单稳态触发电路、555构成的施密特触发器
- MySQLTuner,一个用Perl编写的脚本,它允许你快速审查MySQL安装情况,并进行调整以提高性能和稳定性
- 冒泡排序 基础排序 插入排序 快速排序 双路快速排序 三路快速排序 堆排序.zip
- 数电实验四:加法计数器、减法计数器、加法器、建议数字钟、74LS192功能测试
- JSP基于网络超市商品销售管理系统的设计与实现(源代码+lw).zip
- JSP基于WEB网上论坛设计与实现(源代码+lw+开题报告+答辩PPT+外文翻译).zip
- JSP基于WEB的图书馆借阅系统的设计与实现(源代码+lw).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功