MATLAB Answers

0

trainFaste​rRCNNObjec​tDetector does not work

Asked by YUNYI GUANG on 6 Jul 2019
Latest activity Commented on by Dheeraj Singh on 5 Aug 2019
clear all
close all
clc
FIRE_PATH = 'DataSet\posFire\';
load('DataSet\posFire\fires_training.mat');
% set up parameters
doTrainingAndEval = true;
options = trainingOptions('sgdm', ...
'MaxEpochs', 5, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
if doTrainingAndEval
% Train Faster R-CNN detector.
% * Use 'vgg16' as the feature extraction network.
% * Adjust the NegativeOverlapRange and PositiveOverlapRange to ensure
% training samples tightly overlap with ground truth.
[detector, info] = trainFasterRCNNObjectDetector(fires_training, 'vgg16', options, ...
'NegativeOverlapRange', [0 0.3], ...
'PositiveOverlapRange', [0.6 1]);
save(strcat(FIRE_PATH,'fasterRCNNVgg16FireDetection.mat'), 'detector');
else
% Load pretrained detector for the example.
pretrained = load('fasterRCNNResNet50FireDetection.mat');
detector = pretrained.detector;
end
% testing
I = imread('DataSet\posFire\Testing\6_12.jpg');
[box, score, label] = detect(detector, I);
Hi all, I met a problem when using the detect function which is displayed in the last two lines. When I run the code to test one image, the returning box and score are null. I don't know whether there is something wrong with the detector or not. But everything goes well when I use the ResNet50 rather than VGG16.
My MATLAB version is 2018b.
Please help me!

  2 Comments

For further information, the vgg16 detector I've trained is shared with this link: https://drive.google.com/open?id=1DU1104zvvNMAPF2K_1mO6CJoHdnmguGH
Thanks all!
Using the mat file, you provided, we can see that the network might not have converged. Please check the training parameters. Please refer to the following link for setting the parameters:

Sign in to comment.

0 Answers