Clear Filters
Clear Filters

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?

2 views (last 30 days)
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')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool1')
convolution2dLayer(filterSize, 32, 'Padding', 1, 'name','conv_2',...
'WeightsInitializer', 'narrow-normal')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool2')
convolution2dLayer(filterSize, 64, 'Padding', 1, 'name','conv_3',...
'WeightsInitializer', 'narrow-normal')
maxPooling2dLayer(2, 'stride',2,'Name','maxpool3')
convolution2dLayer(filterSize, 128, 'Padding', 1, 'name','conv_4',...
'WeightsInitializer', 'narrow-normal')
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, ...
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;

Answers (1)

Birju Patel
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?
  1 Comment
Omer Ifrah
Omer Ifrah on 8 Sep 2022
The trainingDataTable and trainingData is not contain the same data.The detector that I trained from checkpoint did worse on the test set then the detector that I trained in one go do this is the problem.

Sign in to comment.


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!