How can i use CNN?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(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);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Recognition, Object Detection, and Semantic Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!