clc;
clear;
close all;
warning off;
addpath(genpath(pwd));
rng('default')
trainD(:,:,:,1)=rand(22,5,3);
trainD(:,:,:,2)=rand(22,5,3);
trainD(:,:,:,3)=rand(22,5,3);
trainD(:,:,:,4)=rand(22,5,3);
targetD=categorical([0;0;1;1]);
%% Define Network Architecture
% Define the convolutional neural network architecture.
layers = [
imageInputLayer([22 5 3]) % 22X5X3 refers to number of features per sample
convolution2dLayer(5,16,'Padding','same') % 5x5 filtr is used, u can try 3x3 filtr also
% padding -- same, means output of conv layer is same siz as input(automatic padding)
% stride if not speficied means its 1; stride window movement steps os
% speed over image
% vist this website for easy cnn understanding, http://cs231n.github.io/convolutional-networks/
reluLayer % activation function
% i have not used any pooling layer here, since small data size
% if u giving big data use pooling layer
% pooling layer reduces size of the matrix
fullyConnectedLayer(384) % 384 refers to number of neurons in next FC hidden layer
fullyConnectedLayer(384) % 384 refers to number of neurons in next FC hidden layer
fullyConnectedLayer(2) % 2 refers to number of neurons in next output layer (number of output classes)
softmaxLayer
classificationLayer];
options = trainingOptions('sgdm',...
'MaxEpochs',500, ...
'Verbose',false,...
'Plots','training-progress');
net = trainNetwork(trainD,targetD',layers,options);
predictedLabels = classify(net,trainD)'
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
1.版本:matlab2022a,包含仿真操作录像,操作录像使用windows media player播放。 2.领域:CNN卷积神经网络。 3.内容:基于MATLAB深度学习工具箱的CNN卷积神经网络训练和测试仿真。分别测试一维卷积,二维卷积以及三维卷积。 layers = [ imageInputLayer([22 1 1]) % 22X1X1 refers to number of features per sample convolution2dLayer(3,16,'Padding','same') reluLayer fullyConnectedLayer(384) % 384 refers to number of neurons in next FC hidden layer 4.注意事项:注意MATLAB左侧当前文件夹路径,必须是程序所在文件夹位置,具体可以参考视频录。
资源推荐
资源详情
资源评论
收起资源包目录
基于MATLAB深度学习工具箱的CNN卷积神经网络训练和测试仿真.rar (6个子文件)
仿真操作录像0008.avi 184.25MB
1.png 81KB
基于MATLAB深度学习工具箱的CNN卷积神经网络仿真
Runme2d.m 1KB
Runme1d.m 1KB
Capture.PNG 78KB
Runme3d.m 2KB
共 6 条
- 1
fpga和matlab
- 粉丝: 15w+
- 资源: 2546
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页