why train yolov2 detector on the same images give two differnet result when you train it in one go do and other when you train them via checkpoint?
1 view (last 30 days)
Show older comments
Why when I train my detector in one go do I get better results than when I train it on the same images but the only difference is that I use checkpoint?
I use that code to create the detector:
inputLayer = imageInputLayer([128 128 3],'Name','Input','Normalization','none');
filterSize = [3 3];
middleLayers = [
convolution2dLayer(filterSize, 16, 'Padding', 1, 'name','conv_1',...
'WeightsInitializer', 'narrow-normal')
batchNormalizationLayer('Name','BN1')
reluLayer('Name','relu_1')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool1')
convolution2dLayer(filterSize, 32, 'Padding', 1, 'name','conv_2',...
'WeightsInitializer', 'narrow-normal')
batchNormalizationLayer('Name','BN2')
reluLayer('Name','relu_2')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool2')
convolution2dLayer(filterSize, 64, 'Padding', 1, 'name','conv_3',...
'WeightsInitializer', 'narrow-normal')
batchNormalizationLayer('Name','BN3')
reluLayer('Name','relu_3')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool3')
convolution2dLayer(filterSize, 128, 'Padding', 1, 'name','conv_4',...
'WeightsInitializer', 'narrow-normal')
batchNormalizationLayer('Name','BN4')
reluLayer('Name','relu_4')
];
Igraph = layerGraph([inputLayer; middleLayers]);
numClasses = size(trainingDataTable,2)-1;
edit codeFiles\AnchorBoxes.m;
Anchors = [43 59
18 22
23 29
84 109];
Igraph = yolov2Layers([128 128 3],numClasses,Anchors,Igraph,'relu_4');
options = trainingOptions('sgdm', ...
'InitialLearnRate', 0.001, ...
'Verbose',true, 'MiniBatchSize',16,'MaxEpochs',30,...
'Shuffle','every-epoch', 'verboseFrequency',30, ...
'ExecutionEnvironment','parallel');
and when I train from checkpoint I use this code:
data = load('/checkpath/yolov2_checkpoint__216__2022_7_15__13_34_30.mat');
checkpoint = data.detector;
0 Comments
Answers (1)
Birju Patel
on 8 Sep 2022
When you train from a checkpoint, you are resuming or continuing the training. If you continue to train the detector for more iterations on the same data, you may overfit to the training set and then do worse on your test set.
It wasn't clear if you did worse on your training set or the test set, so you should clarify that in your question.
It's also not clear whether trainingDataTable and trainingData contain the same data. Perhaps that is why you see different results?
See Also
Categories
Find more on Recognition, Object Detection, and Semantic Segmentation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!