LeNet-5网络模型图
(引自https://www.cnblogs.com/wuliytTaotao/p/9544625.html)
代码如下(详情见注释,很详细):
%% 导入数据
digitDatasetPath = fullfile('./', '/train_HandWrittenDataset/');
imds = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
%imds = imageDatastore(digitDatasetPath,...
%'IncludeSubfolders',true,'FileExtensions','.jpg','LabelSource','foldernames');
tmp=[];
tmp1=[];
tmp2=[];
for i=23:44:440
tmp=[tmp;imds.Files(i:i+21)];
end
for i=0:1:9
tmp1=categorical(ones(22,1)*(i)