Training the RCNN Detector with multivariable from groundtruth

1 view (last 30 days)
Hi guys
Hope you are doing well
I have one code which is for Traning the RCNN object detector for detecting the smoke
i made dataset for labelling set of images which have many variable such as sky cars people smoke however i want in my code that to train the detector to detect smoke and not to detect the other variables which are labelled
currently in my code i can only make selecetlabels for smoke and traning the detector with smoke but i want to know how to select other variables and train the detector not to detect or select other variables
herein my code
load('gTruth.mat')
smokedetection = selectLabels(gTruth,'smoke');
if isfolder(fullfile('TrainingData'))
cd TrainingData
else
mkdir TrainingData
end
addpath('TrainingData');
options = trainingOptions('sgdm', ...
'MiniBatchSize', 32, ...
'InitialLearnRate', 1e-6, ...
'MaxEpochs', 10);
layers = [
imageInputLayer([32 32 3],"Name","imageinput")
convolution2dLayer([5 5],32,"Name","conv","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
maxPooling2dLayer([3 3],"Name","maxpool","Stride",[2 2])
reluLayer("Name","relu")
averagePooling2dLayer([3 3],"Name","avgpool","Stride",[2 2])
fullyConnectedLayer(2,"Name","fc_rcnn","BiasL2Factor",1,"BiasLearnRateFactor",10,"WeightLearnRateFactor",20,"WeightsInitializer","narrow-normal")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
trainingData = objectDetectorTrainingData(smokedetection,'SamplingFactor',1,...
'WriteLocation','TrainingData');
detector = trainRCNNObjectDetector(trainingData, layers, options, ...
'NegativeOverlapRange', [0 0.3]);
save('Detector.mat','detector');

Accepted Answer

Kritika Bansal
Kritika Bansal on 13 Sep 2019
Hi,
As per my understanding, you need a way to train the RCNN object detector to detect classes other than smoke.
Assuming you are using MATLAB R2019a, you can use the following functions to select the ground truth data for a set of labels:
  1. selectLabelsByGroup(): https://www.mathworks.com/help/vision/ref/groundtruth.selectlabelsbygroup.html
  2. selectLabelsByName(): https://www.mathworks.com/help/vision/ref/groundtruth.selectlabelsbyname.html

More Answers (0)

Community Treasure Hunt

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

Start Hunting!