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

Negative samples #291

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi @hunglc007, I was going through the Dataset class source code (core.dataset.py), I stumbled upon this :

def load_annotations(self, dataset_type):
        with open(self.annot_path, 'r') as f:
            txt = f.readlines()
            annotations = [line.strip() for line in txt if len(line.strip().split()[1:]) != 0]
        np.random.shuffle(annotations)
        return annotations

This line more specifically :

annotations = [line.strip() for line in txt if len(line.strip().split()[1:]) != 0]

This line of code is filtering negative samples (Images without the existence of the object). I may be missing something, somewhere. But, shouldn't negative samples be included in training ?

Thank you in advance.