在上一篇博客中,讲解了怎么用matlab搭建CNN网络模型,并给出了训练过程与结果。但是结果不是很满意,大概训练精度在80%左右,现在给出改进方案。
1.首先,我们可以把CNN滤波输出数改大点,从原来的32改为numFilters = 128,完整的程序如下:
[trainingImages,trainingLabels,testImages,testLabels] = helperCIFAR10Data.load('cifar10Data');
numImageCategories = 10;
categories(trainingLabels)
[height, width, numChannels, ~] = size(trainingImages);
imageSize = [height width numChannels];
inputLayer = imageInputLayer(imageSize)
% Convolutional layer parameters
filterSize = [5 5];
numFilters = 128;
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)
% Note that the third dimension of the filter

该博客详细介绍了如何通过增大CNN滤波器数量,从32增至128,提升MATLAB深度学习模型的训练精度,最终达到96%以上。同时,文章指出高精度训练结果在测试集上的表现未见显著提升,可能是过拟合导致的High variance问题,并提出了解决过拟合的必要性。
最低0.47元/天 解锁文章
307





