zylo117 / Yet-Another-EfficientDet-Pytorch

The pytorch re-implement of the official efficientdet with SOTA performance in real time and pretrained weights.
GNU Lesser General Public License v3.0
5.21k stars 1.27k forks source link

Overfitting Regression Loss #684

Open alfanme opened 3 years ago

alfanme commented 3 years ago

Hi @zylo117, first I'd like to thank you for providing such a convenient training flow using your repo.

I'm working with a foggy image dataset that contains 2 classes (car & person) with 1000 training images and 200 validation images (image size 2048 x 1280). Since I only use Tesla P100 16GB (Colab) for the training, I don't have a big chance to use d5 for high res input size.

After reading all issues and your suggestions on this repo, I chose D0 and forced the input size to 1280. The mAP and inference result was pretty good (in my opinion). But when I look at the loss curves especially the regression loss, it's clear that overfitting happened even from the early steps.

This is how the regression loss curves looks like:

Screen Shot 2021-08-13 at 00 17 37

This is the coco_eval result:

Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.578
Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.839
Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.629
Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.058
Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.473
Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.750
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.188
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.626
Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.654
Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.058
Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.584
Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.805

This is the inference result: image

I also calculated the anchors_ratio using this repo as you suggested.

anchors_scales: '[2 ** 0, 2 ** (1.0 / 3.0), 2 ** (2.0 / 3.0)]'
anchors_ratios: '[(0.6, 1.7), (0.8, 1.3), (1.1, 0.9)]'

I'm new to the object detection field. So, I'd really appreciate your input about how can I fix the overfitting regression loss. Thanks in advance.

Note: I haven't applied any augmentation method, would it be one of the possible solutions?

zylo117 commented 3 years ago

it's not overfitting. keep training