Manually Plotting the graph from R-CNN training parameters
1 回表示 (過去 30 日間)
古いコメントを表示
Abdussalam Elhanashi
2019 年 11 月 29 日
コメント済み: Raunak Gupta
2019 年 12 月 5 日
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 件のコメント
採用された回答
Raunak Gupta
2019 年 12 月 2 日
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 件のコメント
Raunak Gupta
2019 年 12 月 5 日
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!