R-CNN detector
Show older comments
I have trained Alexnet via transfer learning for my 4 categories(Bush,Branch,Tree,Rock)...How to make a R-CNN detector that i can use for my new images to detect objects within those categories?
Here is the code i used to train my network.
%% Load a pre-trained, deep, convolutional network
alex = alexnet;
layers = alex.Layers
%% Modify the network to use four categories
layers(23) = fullyConnectedLayer(4);
layers(25) = classificationLayer
%% Set up our training data
allImages = imageDatastore('myImages', 'IncludeSubfolders', true, 'LabelSource', 'foldernames');
[trainingImages, testImages] = splitEachLabel(allImages, 0.8, 'randomize');
%% Re-train the Network
opts = trainingOptions('sgdm', 'InitialLearnRate', 0.001, 'MaxEpochs', 20, 'MiniBatchSize', 64);
myNet = trainNetwork(trainingImages, layers, opts);
%% Measure network accuracy
predictedLabels = classify(myNet, testImages);
accuracy = mean(predictedLabels == testImages.Labels)
Answers (1)
Srivardhan Gadila
on 7 Apr 2020
0 votes
The total number of classes the RCNNdetector should detect will be the number of object classes you want to detect plus an additional background class.
Categories
Find more on Object Detection 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!