Description
Hi there, I've really enjoyed following your tutorial on implementing the YOLOv3 algorithm. I've been testing my own YOLOv3 model built from scratch (to work with 1D data inputs and 1D convolutions, so technically speaking not a typical YOLOv3 model). Please note that I'm also using my own dataset of 1D arrays I generated. I have noticed the following during testing:
When removing the has_anchor[scale_idx]
check (line 73
of dataset.py
) I seem to get predictions with much higher confidence and a higher recall overall. I also seem to be getting a lot fewer false positives (mainly wrong classifications on an object that already has been classified with the correct class). I've noticed that in the README you under the heading "Things I'm unsure of" you discuss exactly this feature of the target selection at various scales, and you seem unsure how this affects prediction quality.
I've had a look at the Ultralytics implementation of target assignment (they assign targets at loss calculation, not during dataset loading). They do loop over the anchors and select the best matching target I believe, but they do not check based on if every scale has one anchor. I'm not 100% sure on this because their implementation is quite dense and somewhat unreadable, but this supports my hunch that this check is superfluous and may impact learning.
For me this makes some sense intuitively however, since by forcing targets onto all scales, you might choose sub-optimal anchor boxes, which in the loss calculation step lowers the IOU and thereby impedes loss minimization towards objectness (as this is weighted by the IOU in your implementation).
Let me be clear that I'm not sure if this is true generally, I've not tested it on the VOC or MS COCO datasets using your repo, but it might be worth looking into to see if it affects performance! You, or anyone implementing your code for themselves, might want to test to see if it helps improve their training results.