Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to improve accuracy of detecting small objects? #545

Closed
PhoenyHan opened this issue Aug 20, 2021 · 18 comments
Closed

How to improve accuracy of detecting small objects? #545

PhoenyHan opened this issue Aug 20, 2021 · 18 comments
Labels
High Priority This issue will be handled in high priority

Comments

@PhoenyHan
Copy link

I trained yolox_L model for 100 epochs, the detection for big objects is good but is bad for small objects. The confidence for small targets is too low that cannot show the bounding box with a normal conf and nms value. Could anyone provide idea on how to improve it? Thanks a lot

@Joker316701882
Copy link
Member

@PhoenyHan How small are your objects? Are they smaller than 8x8 pixels?

@jjn037
Copy link

jjn037 commented Aug 22, 2021

coco evel, small object AP < 0.3

@PhoenyHan
Copy link
Author

@PhoenyHan How small are your objects? Are they smaller than 8x8 pixels?

not that small, they are just car plates and can be recognized well by yolov4

@PhoenyHan
Copy link
Author

@PhoenyHan How small are your objects? Are they smaller than 8x8 pixels?

not that small, they are just car plates and can be recognized well by yolov4

@Joker316701882

@Joker316701882
Copy link
Member

@PhoenyHan Can you show me your exp file and training command? I need to make sure you correctly configure your experiments.

@PhoenyHan
Copy link
Author

@Joker316701882 I didn't change any thing in yolox_base.py. I'm using VOC exp file provided by you and only changed the model depth and width to 1.0. Training command is : python tools/train.py -f exps/example/yolox_voc/yolox_voc_l.py -d 3 -b 24 --fp16 -c yolox_l.pth.tar

@Joker316701882
Copy link
Member

@PhoenyHan You may set the self.random_size = (10, 26) so that there will be more small objects during training (currently it is set to 14, 26. The explanation of these numbers can be found here). Also, the performance at the 100th epoch for yolox is far from convergence. We close the data aug at 285th epoch, which will greatly improve the performance(4~6 mAP in our experiments).

But if you don't want to train 300epochs, you may reduce the self.max_epoch = 300 to 100. Just make sure when you stop the training, the augmentation has already closed for a few epochs.

@PhoenyHan
Copy link
Author

@Joker316701882 Thanks for your suggestion! The problem of my dataset is that there are small objects as well as big foreground objects. I tried to increase the input size to 800*800, I found that by increasing input size, the accuracy of detecting small objects will be better but will be worse for big objects. It's hard to find a balance. Do you have any suggestion for the dataset containing both big and small objects? Thx a lot

@Joker316701882
Copy link
Member

@PhoenyHan Given your current situation (800x800, with relatively poor performance on the big objects), you can try to add P6 in FPN layers, which will increase the receptive field.

By the way, can get good results on both small and big objects with a single yolov4 model without p6 layers and input size 640x640?

@PhoenyHan
Copy link
Author

@Joker316701882 yes, it's weird that using default setting of yolov4 can get a much better result than yolox. The mAP in yolov4 can reach 90%+ but in yolox it's only 80% or lower

@Joker316701882
Copy link
Member

@PhoenyHan Interesting. Is it possible to share your data with us in private?

@Joker316701882 Joker316701882 added the High Priority This issue will be handled in high priority label Aug 24, 2021
@PhoenyHan
Copy link
Author

@Joker316701882 Sorry that I cannot share my data. I noticed that my dataset is direction sensitive so flipping augmentation may make the training result worse. How to close the flipping augmentation in YOLOX? thx

@Joker316701882
Copy link
Member

@PhoenyHan You can modify the code here:

image_t, boxes = _mirror(image, boxes)

Let us know if you get better results.

@Joker316701882
Copy link
Member

This issue has been solved by #600 .

@BatmanofZuhandArrgh
Copy link

Hi @PhoenyHan , I don't think car plates would be much direction sensitive right? I'm also training on license plates. Did you achieve higher AP after disabling flipping augment?

@PhoenyHan
Copy link
Author

@BatmanofZuhandArrgh My datasets include arrows that are direction sensitive, it's not for license plates.

@BatmanofZuhandArrgh
Copy link

BatmanofZuhandArrgh commented Oct 19, 2021

Got it, thanks a lot!

@developer0hye
Copy link
Contributor

developer0hye commented Apr 14, 2022

@PhoenyHan You may set the self.random_size = (10, 26) so that there will be more small objects during training (currently it is set to 14, 26. The explanation of these numbers can be found here). Also, the performance at the 100th epoch for yolox is far from convergence. We close the data aug at 285th epoch, which will greatly improve the performance(4~6 mAP in our experiments).

But if you don't want to train 300epochs, you may reduce the self.max_epoch = 300 to 100. Just make sure when you stop the training, the augmentation has already closed for a few epochs.

Hi @Joker316701882

Thanks for sharing your works!

I have a question.

Closing the augmentation in the second half of the training phase can improve detection accuracy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority This issue will be handled in high priority
Projects
None yet
Development

No branches or pull requests

5 participants