Darknet: why the yolov3-voc.cfg anchor is that??

Created on 30 Mar 2018  路  11Comments  路  Source: AlexeyAB/darknet

@AlexeyAB
yolov3-voc.cfg anchor is that: anchors = 10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326
however gen_ancher is that : 0.37,1.56, 0.53,0.54, 0.76,3.03, 1.21,1.17, 1.98,2.37, 3.08,6.33, 3.54,2.36, 5.38,3.28, 6.01,9.09

Most helpful comment

  • gen_anchors.py is for old Yolo v2
  • For Yolo v3 use darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -heigh 416

All 11 comments

  • gen_anchors.py is for old Yolo v2
  • For Yolo v3 use darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -heigh 416

Hi, @AlexeyAB
Can this cmd used for old Yolo v2 ?
for example:
darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 1280 -heigh 760
or use such: width need devide 32(width/32) and heigh too
I checked many issues, but still confused

@gangyahaidao

or use such: width need devide 32(width/32) and heigh too

Yes, you should use (width/32) and (height/32) for yolo v2:

  • Yolo v2: darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 13 -heigh 13
  • Yolo v3: darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -heigh 416

So quickly!!
Thank you , you saved me more than 10 hours @AlexeyAB

but if my images width=1280 heigh=760, can i use width=416 too?

Tell the truth that, i have used 416 to train a weights file, but the result is a little strange, it cannot detect

small and far hands

Should I change my cfg file's width and height to the real size?? (for now is 1280 760)
In README file you said that we should increase width and height to detect small object, so i guess the width and height in cfg file is not the real image size, am i right?

@gangyahaidao Use width and height in cfg file by default.
width and height is a size of neural network.
Anchors depends only on width and height in cfg file, but indenepent of image size.

Ok, glad to hear that, now I will try

@AlexeyAB Thanks for your code and detailed reply for almost everyone!
I have 2 questions here:

  1. If I want to recalculate the anchors, what should I do if I run the following cmd but get no results and even no error info?
    darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -heigh 416
  2. Why so many nan exist in the training process, but the results are not bad afterwards?

Check that you have images (and labeles) dataset that specified in the file data/voc.data in train=
This is how Yolo v3 works)

@AlexeyAB Thank you for your reply! ONE last thing: how to know where to find the labels? The dir structure is:
data/xxdevkit/xx2017/ [Annotations,ImageSets,JPEGImages,labels] data/train.txt data/test.txt data/xx.data
and I have wrote:
classes= 22 train = data/train.txt test = data/test.txt names = data/xx.names backup = backup_test
what should I do then? The 'data/train.txt' only define where to find the images, but how to find the labels?

By the way, I also tried to create a new file 'train_labels.txt' and put the labels paths in it and set 'train=train_labels.txt', and then run the recalculate cmd, but nothing displayed too.

Please help me,
thank you !

@ShiningCoding

  • Show 5 lines from the train.txt
  • Labels should be

    • or in the same folder where are images

    • or in the folder labels

And labels should have the same name as image, but with txt extension.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shootingliu picture shootingliu  路  3Comments

yongcong1415 picture yongcong1415  路  3Comments

Yumin-Sun-00 picture Yumin-Sun-00  路  3Comments

Jacky3213 picture Jacky3213  路  3Comments

rezaabdullah picture rezaabdullah  路  3Comments