How can i use CNN?
이전 댓글 표시
I have a 3D feature set [10x2000x9, 10x2000x9,10x2000x9......................10x2000x9] and corrosponding ground truth in 4 class like [0,1,2,3]. Means for each 10x2000x9 their will be a ground truth from 0 to 3. How can i use CNN for this to classify in multiclass?
댓글 수: 1
KSSV
2021년 3월 22일
You may go through the examples and pick the code and extend to your case.
답변 (1개)
Srivardhan Gadila
2021년 3월 28일
You can refer to Create Simple Deep Learning Network for Classification, Training a Model from Scratch, Get Started with Deep Learning Toolbox & Deep Learning Toolbox. Also the following code might give you some idea to get started quickly:
inputSize = [10 2000 9];
numSamples = 128;
numClasses = 4;
%% Generate random data for training the network.
trainData = randn([inputSize numSamples]);
trainLabels = categorical(randi([0 numClasses-1], numSamples,1));
%% Create a network.
layers = [
imageInputLayer(inputSize,'Name','input')
convolution2dLayer(3,16,'Padding','same','Name','conv_1')
batchNormalizationLayer('Name','BN_1')
reluLayer('Name','relu_1')
fullyConnectedLayer(10,'Name','fc1')
fullyConnectedLayer(numClasses,'Name','fc2')
softmaxLayer('Name','softmax')
classificationLayer('Name','classOutput')];
lgraph = layerGraph(layers);
%% Define training options.
options = trainingOptions('adam', ...
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise',...
'MaxEpochs',100, ...
'MiniBatchSize',128, ...
'Verbose',1, ...
'Plots','training-progress');
%% Train the network.
net = trainNetwork(trainData,trainLabels,layers,options);
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!