ethanyanjiali / deep-vision

Learning and replicating famous deep learning models for computer vision tasks
179 stars 52 forks source link

YOLO Number of Detection 0, and high loss values... #23

Open djkim9031 opened 3 years ago

djkim9031 commented 3 years ago

Hi, thank you for your great content! I have been working with YOLOv3 model, and my training/val datasets were VOC 2007. so 2500 examples. Training went smoothly, and at around 120 epochs, Batch Loss: 39.9973106 Batch xy Loss: 4.36395788 Batch wh Loss: 3.9135325 Batch obj Loss: 21.7637806 Batch class Loss: 9.95604134 was an average batch report.

Given binary_cross_entropy defined that takes the clipped values from 1e-7 ~ 1-1e-7, when things are completely off, the loss is around 16. And as you can see, the batch obj loss is above 16 and class loss is just a bit better. But still it is not as good.

Using the postprocessor class, with iou_thresh=0.5 and score_thresh=0.5, the number of detection is 0. when I checked the max value for the objectness from y_pred, it was around 0.01.

So, I tweaked score_thresh to 0.01. Only then, the detection was 1 or 2 in many cases. But then predicted classes were mostly "Person". So it seemed like somehow model has a modal collapse where loss value doesn't improve and most predictions are biased towards "person"

Is it perhaps because the model is still under-trained? In your MSCOCO example, it seems like even with 50-ish epochs, and similar loss values as mine(42 in your case), your predictions were quite accurate. Mine is completely off with VOC.

Any suggestions please?