Problem with RCNN Detector
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Guys
I have a problem with RCNN detector as i am trying to train the detector for smoke images which is basiclly with layers Herein the code :-
any solution
Thank you in advance
load('gTruth.mat')
load('layers')
smokedetection = selectLabels(gTruth,'smokealarm');
if isfolder(fullfile('TrainingData'))
cd TrainingData
else
mkdir TrainingData
end
addpath('TrainingData');
trainingData = objectDetectorTrainingData(smokedetection,'SamplingFactor',4,...
'WriteLocation','TrainingData');
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")
convolution2dLayer([5 5],32,"Name","conv_1","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_1")
averagePooling2dLayer([3 3],"Name","avgpool","Stride",[2 2])
convolution2dLayer([5 5],64,"Name","conv_2","BiasLearnRateFactor",2,"Padding",[2 2 2 2],"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_2")
averagePooling2dLayer([3 3],"Name","avgpool_1","Stride",[2 2])
fullyConnectedLayer(64,"Name","fc","BiasLearnRateFactor",2,"WeightsInitializer","narrow-normal")
reluLayer("Name","relu_3")
fullyConnectedLayer(2,"Name","fc_rcnn","BiasL2Factor",1,"BiasLearnRateFactor",10,"WeightLearnRateFactor",20,"WeightsInitializer","narrow-normal")
softmaxLayer("Name","softmax")
classificationLayer("Name","classoutput")];
options = trainingOptions('sgdm', ...
'MiniBatchSize', 32, ...
'InitialLearnRate', 1e-6, ...
'MaxEpochs', 10);
imds=trainingData
detector = trainRCNNObjectDetector(trainingData, layers, options, 'NegativeOverlapRange', [0 0.3]);
save('Detector.mat','detector');
and the errors are :-
Error using trainNetwork (line 165)
The class names of layer 13 must match the class names of the training data. The training data class names are given by
categories(Y), where Y are the training data labels.
Error in rcnnObjectDetector.train (line 234)
[net, info] = trainNetwork(dispatcher, layers, opts);
Error in trainRCNNObjectDetector (line 278)
[detector, ~, info] = rcnnObjectDetector.train(trainingData, lgraphOrLayers, options, params);
Error in TrainingsmokedetectionwithRCNN (line 22)
detector = trainRCNNObjectDetector(trainingData, layers, options, 'NegativeOverlapRange', [0 0.3]);
1 commentaire
Dinesh Yadav
le 26 Août 2019
"The class names of layer 13 must match the class names of the training data. The training data class names are given by categories(Y), where Y are the training data labels". The error you displayed is self explanatory. Kindly output and compare the training data class labels with categories(Y) word to word i.e. Spacing, Capitals etc.
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!