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 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Birju Patel
2022-9-8
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?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Recognition, Object Detection, and Semantic Segmentation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!