how to use your scripts to generate my own anchor sizes and scales?
See original GitHub issueDear Sir: I have some problem to understand your cluster_bbox_sizes.py, optimize_bboxes.py and bbox_recall.py. I really want use them to set the parameters: scales aspect_ratios and conv_sizes more reasonable. Could you please explain a little of what these means? Thanks a lot!
I use the default paras as the yolact_base.cfg does, and test the scripts on a dataset
scales = [ [24],[48],[96],[192],[384] ] aspect_ratios = [ [[1, 1/sqrt(2), sqrt(2)]] ]*5 conv_sizes = [(69, 69), (35, 35), (18, 18), (9, 9),(5,5)]
here are the results:
from: cluster
`0.062 (18) aspect ratios:
17.71 (8)
5.23 (8)
109.76 (2)
0.146 (70) aspect ratios: 4.39 (34) 2.26 (30) 0.65 (6)
0.241 (125) aspect ratios: 1.12 (103) 0.23 (21) 0.00 (1) `
from optimize_bbox:
`(Iteration 9) Aspect Ratios: [[[19.03, 0.55, 1.13]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]]]
scales = [[17.53], [60.94], [108.94], [204.94], [396.94]]
aspect_ratios = [[[19.03, 0.55, 1.13]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]], [[13.94, 13.64, 14.24]]] `
from bbox_recall:
`Total recall: 33.80
small recall: 0.00 medium recall: 0.00 large recall: 46.75 `
Thanks a lot! It’s a bit hard for me >o<
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
Actually those aren’t square (at least well they’re not supposed to be). Aspect ratio means the ratio between width and height. So an aspect ratio of sqrt(2) means that the width is sqrt(2) times the height (i.e., w/h = sqrt(2)). I realized I had a bug while implementing this (see #19) which resulted in the width and height set to the same number (equal to what the width should have been). For paper reproducability reasons, I’m keeping the bug in until we release v1.1, but if you want to fix it yourself, change this line: https://github.com/dbolya/yolact/blob/ad167c0a72169b68a0e68ea7bcd0e6b0b9e53834/yolact.py#L266 to:
scale / ar / cfg.max_size
Then by P-R you mean the precision-recall curve? I don’t have a script to plot that, but you can find the precisions and recalls here if you want to plot them yourself: https://github.com/dbolya/yolact/blob/ad167c0a72169b68a0e68ea7bcd0e6b0b9e53834/eval.py#L498
And go ahead and try to implement YOLACT in YOLO if you’d like. Let me know if you get some good results!
Also, I’ve updated the clustering script. To use, run
python scripts/save_bboxes.py
from the root YOLACT directory, which will save a numpy array of all the bounding boxes in the 2017 COCO training set. Once you have that runpython scripts/cluster_bbox_sizes.py
and it’ll output 5 suggested bounding box scales, along with 3 aspect ratios for each scale. To use those scales and aspect ratios, simply replace https://github.com/dbolya/yolact/blob/fd84079b53e2325b5bb451a0029736f20cbee0ed/data/config.py#L590 with the scales it gives and https://github.com/dbolya/yolact/blob/fd84079b53e2325b5bb451a0029736f20cbee0ed/data/config.py#L589 with the aspect ratios ([ [[scale1_ar1, scale1_ar2, scale1_ar3]], [[scale2_ar1, scale2_ar2, scale2_ar3]], etc. ]
)optimize_bboxes.py
was a test that unfortunately never ended up working (instead of clustering scales and aspect ratios, how about we try to directly optimize the recall?) The scales and aspect ratios it produces result in much worse performance.cluster_bbox_sizes.py
is the standard approach, but it hasn’t been updated for a very long time so is completely broken (it looks like it’s suggesting aspect ratios of 17.7 and 109.6 which are a little on the absurd side).I can update
cluster_bbox_sizes.py
if you’d like, but I should probably get rid ofoptimize_bboxes.py
.