Manually Plotting the graph from R-CNN training parameters
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Abdussalam Elhanashi
el 29 de Nov. de 2019
Comentada: Raunak Gupta
el 5 de Dic. de 2019
Hi Guys
I have a problem when i want to make a graph for the training phase like between Epoch & Mini-batch Loss
Herein the code
load('gTruth.mat')
smokedetection = selectLabels(gTruth,'car');
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');
[detector,info] = trainRCNNObjectDetector('Epoch','Mini-batch Loss','Training Accuracy','Base Learning Rate','Mini-batch Accuracy');
x = ('Epoch');
y = ('Mini-batch Loss');
figure
plot(x,y)
title('Training Phase')
xlabel('Number of Epochs')
ylabel('Training Loss')
Error
Error using trainRCNNObjectDetector
Expected input number 1, trainingData, to be one of these types:
table
Error in vision.internal.cnn.validation.checkGroundTruth (line 2)
validateattributes(gt, {'table'},{'nonempty'}, name, 'trainingData',1);
Error in trainRCNNObjectDetector>parseInputs (line 311)
vision.internal.cnn.validation.checkGroundTruth(trainingData, fname);
Error in trainRCNNObjectDetector (line 248)
[network, params] = parseInputs(trainingData, network, options, mfilename, varargin{:});
Error in TrainingSmokeDetectionwithRCNN (line 29)
[detector,info] = trainRCNNObjectDetector('Epoch','Mini-batch Loss','Training Accuracy','Base
Learning Rate','Mini-batch Accuracy');
0 comentarios
Respuesta aceptada
Raunak Gupta
el 2 de Dic. de 2019
Hi,
The trainingOptions for trainRCNNObjectDetector does not support plotting the train-progress while the training is going on, but the training parameters are returned at the end of training if trainRCNNObjectDetector is used with following arguments.
[detector,info] = trainRCNNObjectDetector(___)
In the script from the question following command looks incorrect,
[detector,info] = trainRCNNObjectDetector('Epoch','Mini-batch Loss','Training Accuracy','Base Learning Rate','Mini-batch Accuracy');
instead the above can be replaced by
[detector,info] = trainRCNNObjectDetector(trainingData, layers, options, 'NegativeOverlapRange', [0 0.3]);
Here info will be returned as a structure which contains the ‘Training Accuracy’, ‘Training Loss’ and ‘Base Learning Rate’ for each iteration. These can be then plotted as per required. The error was there because correct input arguments weren’t passed.
7 comentarios
Raunak Gupta
el 5 de Dic. de 2019
Hi,
The loss is calculated for each mini batch that is why the fluctuation is there. You may use smooth to remove too many fluctuations.
Más respuestas (0)
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!