why my training yolov2 network can't work?

4 visualizaciones (últimos 30 días)
cui,xingxing
cui,xingxing el 2 de Ag. de 2019
Comentada: cui,xingxing el 27 de Mzo. de 2020
I trained my data set according to the official documentation, detecting people in the image, only one category. The pre-training network also uses resnet50. The network structure is consistent with the example, but after many trainings, people are still not detected. During this time I tried to use the clustering algorithm to change the size or number of the achor box, the value of MaxEpochs, but still not working. Why is this?
I post my code and data here:
%% 利用resnet50预训练网络进行特征提取
load('gTruthPerson.mat')
% Define the image input size.
ImageWeight = 320;
ImageHeight = 320;
imageSize = [ImageWeight ImageHeight 3];
% Define the number of object classes to detect.
numClasses = 1;
anchorBoxes = [
176 67
150 52
113 42
271 99
99 34
]; % .*ImageWeight/1280
anchorBoxes = round(anchorBoxes);
baseNetwork = resnet50();
% Specify the feature extraction layer.
featureLayer = 'activation_40_relu'; % mobilenetv2 的是'global_average_pooling2d_1';
% Create the YOLO v2 object detection network.
lgraph = yolov2Layers(imageSize,numClasses,anchorBoxes,baseNetwork,featureLayer);
doTraining=0;
if doTraining
% Configure the training options.
% * Lower the learning rate to 1e-3 to stabilize training.
% * Set CheckpointPath to save detector checkpoints to a temporary
% location. If training is interrupted due to a system failure or
% power outage, you can resume training from the saved checkpoint.
options = trainingOptions('sgdm', ...
'MiniBatchSize', 24, ....
'InitialLearnRate',1e-3, ...
'MaxEpochs',20,...
'Verbose',1, ...
'VerboseFrequency',1,...
'CheckpointPath', './save', ...
'ExecutionEnvironment','gpu',...
'Shuffle','every-epoch');
% Train YOLO v2 detector.
% pretrained = load('save/yolov2_checkpoint__45__2019_08_02__16_44_13.mat');
% detector = pretrained.detector;
[detector,info] = trainYOLOv2ObjectDetector(gTruthPerson,lgraph,options);
save yoloDetector.mat detector info
else
% Load pretrained detector for the example.
pretrained = load('yoloDetector.mat');
detector = pretrained.detector;
info = pretrained.info;
end
%% test
for i = 1:height(gTruthPerson)
I = imread(gTruthPerson.imageFilename{i});
% I = imresize(I,imageSize(1:2));
% Run the detector.
[bboxes,scores] = detect(detector,I);
% Annotate detections in the image.
if ~isempty(bboxes)
I = insertObjectAnnotation(I,'rectangle',bboxes,scores);
imshow(I)
end
end
all images and annotation files is here: google drive

Respuestas (1)

Song Decn
Song Decn el 14 de Mzo. de 2020
I have same issue with the detector. any updates?
  3 comentarios
enrico campo
enrico campo el 20 de Mzo. de 2020
same problem
cui,xingxing
cui,xingxing el 27 de Mzo. de 2020
From this example, it can be seen that for users, it is very inflexible to watch the internal network. There is a problem there and it is difficult to debug. The official just gives a "yolov2Layers" or "yolov2OutputLayer", so that users cannot understand the design in principle. !!!
The official example is a very common and simple scenario, which cannot be consistent with the actual application!

Iniciar sesión para comentar.

Categorías

Más información sobre Recognition, Object Detection, and Semantic Segmentation en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by