Jumabek / darknet_scripts

Auxilary scripts to work with (YOLO) darknet deep learning famework. AKA -> How to generate YOLO anchors?
223 stars 96 forks source link

General question #11

Open jcgarciaca opened 6 years ago

jcgarciaca commented 6 years ago

Hello, I am training YOLO with my own data. I started with some available examples and they worked well. Nevertheless, when using my data set the network doesn't find any object (although loss value is around 0.06). Since my images have big size with small objects, I read that anchor values must be adjusted, although it is not clear how to do it.

Then, I actually did the following:

  1. Get image width and size
  2. Get every object width and size in any image
  3. Calculate ratio object_width / image_width and object_height / image_height (here all values are less than 1)
  4. Calculate k-means clustering for those ratios
  5. Multiply the values by 13 (grid cell number) and use the values as anchors [w1, h1, w2, h2, ... w5, h5]

Is this process OK?

Thank you.

Jumabek commented 6 years ago

Hi @jcgarciaca , sorry for late response. assuming by size you refer to image height, your steps from 1-4 are correct. However, step 5 is tricky part. The number 13 comes from 416/32. 32 is downsampling factor and always stays same (unless you remove or add new conv layers). 416 is the height and width of the network input size

originally YOLO uses 416x416 input size. However, lets say you have 416x640 (width x height), then your multiplication values should be 416/32 for width 640/32 for height