Darknet: Anchors & Improving Bounding Box

Created on 16 Jan 2020  路  1Comment  路  Source: AlexeyAB/darknet

Hi all,

I'm currently looking to improve the detection of various fruits, vegetables and other subclasses within my yolov3 database. Currently, it works very well except that the boundary box appears much wider and taller than the object. From what I understand, adjusting the anchors should help fix this. I've read How to Improve Object Detection but don't quite understand the part about also adjusting the mask.

"You should change indexes of anchors masks= for each [yolo]-layer, so that 1st-[yolo]-layer has anchors larger than 60x60, 2nd larger than 30x30, 3rd remaining. Also you should change the filters=(classes + 5)* before each [yolo]-layer".

So far I've changed the anchors to the following:
Line 609: anchors = 170,36, 41,227, 292,79, 153,170, 119,333, 319,158, 227,323, 344,261, 381,393
Line 695: anchors = 170,36, 41,227, 292,79, 153,170, 119,333, 319,158, 227,323, 344,261, 381,393
Line 782: anchors = 170,36, 41,227, 292,79, 153,170, 119,333, 319,158, 227,323, 344,261, 381,393

But I'm not sure what to do with the masks at:
Line 608: mask = ?? #Default was 6,7,8
Line 694: mask = ?? #Default was 3,4,5
Line 781: mask = ?? #Default was 0,1,2

Also for changing filters = (classes + 5)*<number of mask>. What exactly is the new number of masks value?

Any help or advice would be greatly appreciated

Most helpful comment

Mask means which anchor to use. As your anchors are 170,36, 41,227, 292,79, 153,170, 119,333, 319,158, 227,323, 344,261, 381,393, mask =6,7,8 means use anchors 227,323, 344,261, 381,393 (7th,8th,9th) in corrsponding yolo layer. In you case, you don't need to change them.
Number of mask means how many anchors do you use in this yolo layer. 3 in your case.

>All comments

Mask means which anchor to use. As your anchors are 170,36, 41,227, 292,79, 153,170, 119,333, 319,158, 227,323, 344,261, 381,393, mask =6,7,8 means use anchors 227,323, 344,261, 381,393 (7th,8th,9th) in corrsponding yolo layer. In you case, you don't need to change them.
Number of mask means how many anchors do you use in this yolo layer. 3 in your case.

Was this page helpful?
0 / 5 - 0 ratings