Yolov3: Train yolov3 to detect tiny objects on small images

Created on 5 Feb 2020  路  21Comments  路  Source: ultralytics/yolov3

Hey guys, I'm training my yolov3 on my custom dataset, every single image in this dataset has a size of 270 * 270. I have been running into some problems and really need some help here.
The task of my model is to detect small icons in a minimap of a MOBA game, the size of these icons is 26*26 pixels. I made sure all labelings are correct before I started my training process, however, during my testing, I found the bounding boxes are smaller than they should be, and classifications are not satisfying. (even though my test scores are high, with P and R both higher than 0.95)
my questions are:

  1. I have been trying to recalculate anchor boxes, any suggestions on calculating anchor boxes on such small images?
  2. what else could I have done to improve my model's precision?
    Thanks in advance!
Stale

Most helpful comment

Please share results when you get a chance. I am interested in hearing how the training went.

All 21 comments

@laol777 thanks for your reply man. I didn't consider other options for the following two reasons: 1. I want to use my model on videos so I can record the position of each object every 1 sec, therefore I think YOLO is a better option 2. There are also other objects with different shapes that I want to detect other than fixed-size icons.

@riozzz you need to examine at your results.png created after training, and probably train longer and increase your training data.

lower the training IoU. Just remember that you will get more false positives.

@glenn-jocher hi man, thanks for your reply, I think I have a big enough dataset (about 110,000 images).
@FranciscoReveriano Thanks man, I will try

@riozzz yes that鈥檚 more than enough images. Then you should train using all default settings, to 300 epochs, and examine your results.png for overtraining etc.

@glenn-jocher thanks Glenn, let me try again

Please share results when you get a chance. I am interested in hearing how the training went.

@FranciscoReveriano hey man, so after we talked about this, I tried to train my model several times and here is my result.png. I think its simply overfitting after 20 epochs
results

Four things you might want to consider.

  • Lower the learning rate by a factor of 10
  • Use a smaller batch size for the training
  • Make sure you have the newest repo
  • Remove rectangular training

I didn't set rect train to True at very first, do I still need to remove it from code?

Honestly it depends on several factors. Rect training speeds everything up. But depending on your data may not be the most ideal thing. I would personally recommend that you try both ways and then see what works best for you. In ML you can never be afraid of training and re-training.

@riozzz is this what you are trying to do ?

Image d鈥檌OS

I did almost exactly what you described with no issue using this repo.

I had 200k+ randomly generated images with 130+ classes (balanced). I added alot of noise to make sure the model learns to detect even if there is things overlapping the icons. Also, make sure the images you train/test on really represent what you are a sending to your model on inference time.

Bonus tip: even if you have 270x270, use a higher img-size for your model, it will benefit from it.

@Ownmarc looks cool man
BTW, can you elaborate on the 'randomly generated images' part? You mean generated these images instead of collecting them?

@riozzz I extracted images from the game file and wrote a script to generate maps with icons on it. Also was able to label all images using this script since I knew where the icons were placed

Ahri Aatrox
1 2
1575501394 873616 1575501394 547606

@Ownmarc So I finally got time to try what you suggested, all went well but at the final step, my model performs well on the generated images but still not on the test images cropped from the high-resolution game videos such as this one.
frames-960
Do you know what might be problem be? what's the size of the images you generated? Thanks!

nvm, I figured out

This issue is stale because it has been open 30 days with no activity. Remove Stale label or comment or this will be closed in 5 days.

Four things you might want to consider.

  • Lower the learning rate by a factor of 10
  • Use a smaller batch size for the training
  • Make sure you have the newest repo
  • Remove rectangular training

@FranciscoReveriano Just curious, could you please let me know how does the smaller batch size help? Thanks.

@riozzz I extracted images from the game file and wrote a script to generate maps with icons on it. Also was able to label all images using this script since I knew where the icons were placed

Ahri Aatrox
1 2
1575501394 873616 1575501394 547606

Hi Marc, i'm interested in your script, can you share me details about it. I would love to use it in my training,

nvm, I figured out

Would you mind elaborating how to improve this? My custom dataset always gets low confidence. Has it got something to do with increasing input size?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NgTuong picture NgTuong  路  4Comments

Blddwkb picture Blddwkb  路  4Comments

MichaelCong picture MichaelCong  路  4Comments

suarezjessie picture suarezjessie  路  5Comments

Deep-Learner picture Deep-Learner  路  5Comments