手把手教你用matlab做深度学习(二)- --CNN

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在上一篇博客中,讲解了怎么用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

评论 24
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值