Open Gumballing opened 6 years ago
I want to recaculate anchors for yolov3-tiny.cfg.
Do you use code from this repository?
I want to recaculate anchors for yolov3-tiny.cfg.
Use the command:
./darknet detector calc_anchors data/voc.data -num_of_clusters 6 -width 416 -height 416
But the result is there no output
Can you show screenshot?
@AlexeyAB The screenshot: https://github.com/gzhengli/YOLO-for-my-data/blob/master/screen%20of%20anchors%20command.png
@gzhengli Do you use code from this repository or from https://github.com/pjreddie/darknet ?
@AlexeyAB The latter .Frome https://github.com/pjreddie/darknet
@gzhengli Try to use this repository: https://github.com/AlexeyAB/darknet
hi! @gzhengli @AlexeyAB What is it "-num_of_clusters"? I want to recalculate to 608x608. Thanks!
@AshleyRoth It is number of anchors (number of pairs of values), it is equal 5 for yolov2, 6 for yolov3-tiny, 9 for yolov3.
@AlexeyAB Thank you!
https://github.com/pjreddie/darknet/issues/577
https://github.com/AlexeyAB/darknet/blob/master/scripts/gen_anchors.py
How to use the above python code for YOLOv3? Are the modifications below all that needed?
# change picture width and height according to the .cfg file
width_in_cfg_file = 448.
height_in_cfg_file = 448.
# comment out "/32."
anchors[i][0]*=width_in_cfg_file #/32.
anchors[i][1]*=height_in_cfg_file #/32.
@AshleyRoth It is number of anchors (number of pairs of values), it is equal 5 for yolov2, 6 for yolov3-tiny, 9 for yolov3.
should the values be fixed according to the architectures or we can random define the number of anchors, i.e., using 7 for yolo3-tiny?
@ouyangkid
You can use any number of anchors, but then you should change number of filters before each [yolo]-layer: https://github.com/AlexeyAB/darknet#how-to-train-to-detect-your-custom-objects
filters=(classes + coords + 1)*num)
@AlexeyAB I am a little confused, therefore, I paste the last two layers from yolov3.cfg
[convolutional] size=1 stride=1 pad=1 filters=255 activation=linear
according to the explain filters=255=(classes+4+1)*3 classes=80, 4 for coords and 1 for objectness. According to the equation from you: filters=(classes + coords + 1)*num), I should modify the 3?
However, the anchors=9 and the "num" in the Yolo layer also equal to 9. Do you mean by modifying this value instead of the one in the filters? Or they all should be modified?
By the way, what does the mask=0,1,2 mean? according to 1 and 2 the last parameter is the mask?
However, the anchors=9 and the "num" in the Yolo layer also equal to 9. Do you mean by modifying this value instead of the one in the filters? Or they all should be modified? filters=(classes + coords + 1)*num)
num
in this equation should be equal to the number of anchors actually used by following [yolo] entity.
And in [yolo] you set this number by setting mask=
. Hence, during training, output of this layer will be matched to ground truth relatively to 1st, 2nd, 3rd anchors from your list, since you set mask=0,1,2
. On the next [yolo] entity you probably have mask=3,4,5
implying that 4th, 5th, and 6th anchors should be employed.
However, num
in [yolo] params:
num=9
- is the number of total anchors in the whole model (so it's constant in all [yolo] params). It should be constant and equal to number of pairs of w/h you have in
anchors=
(which is also constant through out all [yolo] entities in cfg).
p.s. this num=
and anchors=
thing seems weird too me actually, but there should be reason for that.
I also try to calculate anchors of yolov3 by using google colab, and my command line was inputed as below: !./darknet detector calc_anchors obj.data -num_of_clusters 9 -width 416 -height 416 after conducting this command line, the performing log update some new lines as below: and then, 30 mins past, there has nothing updated informatin in log windows, but the button was still rotating. I'm wondering whether this state was good and need I input anything into the command line box in the bottom of the log window? Looking forward for reply, thanks.
I used the command : ./darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -height 416 to recaculate the anchors about my dataset. But the result is there no output,just like this:
zhengli@zhengli-K55VD:~/darknet$ ./darknet detector calc_anchors data/voc.data -num_of_clusters 9 -width 416 -height 416 zhengli@zhengli-K55VD:~/darknet$
Why did this happen?
And in "https://github.com/AlexeyAB/darknet/blob/master/scripts/gen_anchors.py ",Where can I to change the path to recaculate for my dataset?
It's there? ` parser.add_argument('-filelist', default = '\path\to\voc\filelist\train.txt',