why my YOLO v2 detector produces no results?

4 ビュー (過去 30 日間)
Filippo profumo
Filippo profumo 2019 年 8 月 11 日
コメント済み: Enda O Shea 2022 年 5 月 20 日
i use a YOLO v2 detector to detect cells in images like this one (i used this specific one to train the detector) of two different types to train the detector.
i give the detector the boxes as in figure.
boxes.jpg
i use the following lines to train the detector:
T=table(names2',roi1',roi2');
%names2' contains the image file path
%roi1' and roi2' are the matrices M*4 with the [x,y,width,height] of %boxes containing the cells
numClasses=width(T)-1;
anchorBoxes = [
40 40
60 60
80 80
100 100
];
baseNetwork = resnet50;
featureLayer = 'activation_40_relu';
imageSize = [1080 1920 3];
options = trainingOptions('sgdm', ...
'MiniBatchSize', 16, ....
'InitialLearnRate',1e-3, ...
'MaxEpochs',10,...
'CheckpointPath', tempdir, ...
'Shuffle','every-epoch');
lgraph = yolov2Layers(imageSize,numClasses,anchorBoxes,baseNetwork,featureLayer);
[detector,info] = trainYOLOv2ObjectDetector(T,lgraph,options)
----------------------------------------------------------------------------------------------------------------
i get the following outputs:
Training on single CPU.
|========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | RMSE | Loss | Rate |
|========================================================================================|
| 1 | 1 | 00:00:43 | 3.32 | 11.0 | 0.0010 |
| 10 | 10 | 00:07:02 | 1.16 | 1.4 | 0.0010 |
|========================================================================================|
detector =
yolov2ObjectDetector with properties:
ModelName: 'Var2'
Network: [1×1 DAGNetwork]
ClassNames: {'Var2' 'Var3'}
AnchorBoxes: [4×2 double]
TrainingImageSize: [1080 1920]
info =
struct with fields:
TrainingLoss: [11.0190 5.5807 4.0740 3.1020 2.1962 1.3285 1.3990 1.5349 1.6414 1.3550]
TrainingRMSE: [3.3195 2.3623 2.0184 1.7613 1.4820 1.1526 1.1828 1.2389 1.2812 1.1641]
BaseLearnRate: [0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010]
a =
yolov2ObjectDetector with properties:
ModelName: 'Var2'
Network: [1×1 DAGNetwork]
ClassNames: {'Var2' 'Var3'}
AnchorBoxes: [4×2 double]
TrainingImageSize: [1080 1920]
----------------------------------------------------------------------------------------------------------------
when i use the detector to a similar image i get no results. The [bboxes, scores] matrix is empty.
what is my error?

採用された回答

Thomas van der Werff
Thomas van der Werff 2021 年 1 月 28 日
This might not really be relevant anymore but I feel like there are several things to notice here. For example, you're only using one image to train you network. Which means each iteration is 1 epoch which means you've quite a limited amount of trainingdata that you supply to your network. It will most likely learn to look for cells in certain locations of your pictures and not how the cells actually look like. For better results you'll most likely have to provide more pictures or create an augmented set for when you've only a few (flip and resize them for example). 100+ pictures sounds like it might be worth a shot.
Secondly, you're use two anchorboxes of the same format which is a bit unusual. I see you've only used squares to annotate your image but it might be more wiser to take a more precise annotation format in which the cells better fit the boxes and then take 2 anchorboxes based on the dimensions of all your annotations. You can use the estimateAnchorBoxes function for this.
Also, your RMSE is still very high, I thiknk. I don't think you should be suprised nothing was detected. If you want to see all the detections regardless of there error then you can set the threshold of your detector to a lower value or even zero. Something like this could come in handy.
detectionResults = detect(detector, preprocessedTestData, "Threshold", 0);
I also notice you've a very large input format. In my experience, you'll not need to use an input for your network that is much larger than 448x448 or 224x224 for example. Which brings me to the next problem, you're supplying none square images to your network which might result in some strange outcomes. So, I'd recommend resizing the image and its boundingboxes to something smaller. Otherwise you will also have quiet a lengthy processing time for each iteration.
I'm not sure which tutorial you've followed and whether it's normal to use these kind of inputs but all the work I've done with YOLO lets me think that these might not be the right inputs for a good functioning network. For other readers, please correct me where needed.
  1 件のコメント
Filippo profumo
Filippo profumo 2021 年 1 月 28 日
Thomas van der Werff thank you very much for the anwer. You gave my many good suggestions. I haven't been pursuing this attempt to count cells through a neural network for some time. I will certainly take your suggestions as soon as possible to try again on this path.

サインインしてコメントする。

その他の回答 (2 件)

Srivardhan Gadila
Srivardhan Gadila 2019 年 8 月 14 日
編集済み: Srivardhan Gadila 2019 年 8 月 14 日
The bboxes from [bboxes,scores] = detect(detector,img); would be empty when no object is detected by your network. You may also refer to trainyolov2objectdetector.
  2 件のコメント
cui,xingxing
cui,xingxing 2019 年 8 月 14 日
Excuse me,@SriVardhan Gadila , I did it according to the official tutorial,but how can I solve this problem?
Filippo profumo
Filippo profumo 2019 年 8 月 19 日
ok @SriVardhan Gadila but i give the dectector an image with many cells so i have trained incorrectly the network for having no results?

サインインしてコメントする。


Song Decn
Song Decn 2020 年 3 月 14 日
I have the same issue, after training with my labeled data, detector gives no bounding boxes. What is the general solution steps for this?
  1 件のコメント
Enda O Shea
Enda O Shea 2022 年 5 月 20 日
[bboxes,scores, labels] = detect(detector , I, 'Threshold', 0.5);
For those who need an answer in the future, above is it. You need to specify the threshold (here it is 0.5) so everything with a score above it is shown, if you dont specify it takes the threshold as 1 so unless you get a perfect score nothing will show.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by