clear all
close all
clc
FIRE_PATH = 'DataSet\posFire\';
load('DataSet\posFire\fires_training.mat');
doTrainingAndEval = true;
options = trainingOptions('sgdm', ...
'MaxEpochs', 5, ...
'MiniBatchSize', 1, ...
'InitialLearnRate', 1e-3, ...
'CheckpointPath', tempdir);
if doTrainingAndEval
[detector, info] = trainFasterRCNNObjectDetector(fires_training, 'vgg16', options, ...
'NegativeOverlapRange', [0 0.3], ...
'PositiveOverlapRange', [0.6 1]);
save(strcat(FIRE_PATH,'fasterRCNNVgg16FireDetection.mat'), 'detector');
else
pretrained = load('fasterRCNNResNet50FireDetection.mat');
detector = pretrained.detector;
end
I = imread('DataSet\posFire\Testing\6_12.jpg');
[box, score, label] = detect(detector, I);