qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.44k forks source link

Anchors usage in Tiny YOLOv3 #306

Open apatsekin opened 5 years ago

apatsekin commented 5 years ago

https://github.com/qqwweee/keras-yolo3/blob/e6598d13c703029b2686bc2eb8d5c09badf42992/yolov3-tiny.cfg#L175

Are you sure that 1,2,3 should be used for mask on this scale instead of 0,1,2? In this case first anchor seems to be ignored, since there are 6 of them in total, but only 1,2,3,4,5 indices are used.

lindyrock commented 5 years ago

I'm wondering the same thing.

lindyrock commented 5 years ago

However, I tested and detection is much better when using mask = 1,2,3 instead of mask=0,1,2

bluesy7585 commented 5 years ago

@apatsekin I think you are right. 1st anchor is ignored. I noticed that my trained model can not detect small objects. in default anchors for tiny-yolo, 1st is the smallest one.

I changed the code to [0,1,2] and train again, small objects are detected. however, the bounding boxes are not very accurate for small objects. that make sense because tiny-yolo only do detection on 2 scales. it cant see small objects clearly

so maybe its author's intentional design to ignore 1st anchor, and trained 4th anchor on 2 scales. if that's true, only 5 anchors are used in tiny-yolo

Truantboy commented 5 years ago

@bluesy7585 That make sense if the author trained tiny-yolo just using 5 anchors, but I downloaded the tiny-yolo weights from https://pjreddie.com/darknet/yolo/ and just test without training. It also shows that [1,2,3] is better than[0,1,2].