hunglc007 / tensorflow-yolov4-tflite

YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
https://github.com/hunglc007/tensorflow-yolov4-tflite
MIT License
2.23k stars 1.24k forks source link

Fixed crucial bug in dataset.py that resulted in wrong label information #384

Open limchr opened 3 years ago

limchr commented 3 years ago

For generating label data for e.g. training the network, the COCO label information are translated into YOLO grid cell labels. Doing this, an IOU score was calculated wrongly, mixing up pixel-scale and grid-scale coordinates in dataset.py.

This is resulting in very small IOU values for the middle and large grid scale, preventing a training signal for this part of the network. This does may also explain the poorer training performance compared to the original implementation, because 2/3 of the network is not getting a training signal. I fixed the bug simply by dividing the anchor boxes by the strides. Doing this, the IOU is calculated consistently with grid-level coordinates. The resulting target for training the network looks correct now.