How can i use CNN?

2 views (last 30 days)
CHHAVI
CHHAVI on 22 Mar 2021
Answered: Srivardhan Gadila on 28 Mar 2021
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 Comment
KSSV
KSSV on 22 Mar 2021
You may go through the examples and pick the code and extend to your case.

Sign in to comment.

Answers (1)

Srivardhan Gadila
Srivardhan Gadila on 28 Mar 2021
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);

Categories

Find more on Recognition, Object Detection, and Semantic Segmentation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!