why my training yolov2 network can't work?

조회 수: 1 (최근 30일)
cui,xingxing
cui,xingxing 2019년 8월 2일
댓글: cui,xingxing 2020년 3월 27일
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

답변 (1개)

Song Decn
Song Decn 2020년 3월 14일
I have same issue with the detector. any updates?
  댓글 수: 3
enrico campo
enrico campo 2020년 3월 20일
same problem
cui,xingxing
cui,xingxing 2020년 3월 27일
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!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Recognition, Object Detection, and Semantic Segmentation에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by