From 1dbf0269bc2fb14746117ea049dd13ce0513325e Mon Sep 17 00:00:00 2001 From: Eran_G Date: Thu, 30 May 2019 13:47:05 +0300 Subject: [PATCH] csvparser --- .../preprocessing/csv_generator_iou.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/object_detector_retinanet/keras_retinanet/preprocessing/csv_generator_iou.py b/object_detector_retinanet/keras_retinanet/preprocessing/csv_generator_iou.py index 2629161..0aa3dac 100644 --- a/object_detector_retinanet/keras_retinanet/preprocessing/csv_generator_iou.py +++ b/object_detector_retinanet/keras_retinanet/preprocessing/csv_generator_iou.py @@ -102,6 +102,22 @@ def _read_annotations(csv_reader, classes, base_dir, image_existence): try: img_file, x1, y1, x2, y2, class_name, width, height = row[:] + x1 = int(x1) + x2 = int(x2) + y1 = int(y1) + y2 = int(y2) + width = int(width) + height = int(height) + + if x1 >= width: + x1 = width -1 + if x2 >= width: + x2 = width -1 + + if y1 > height: + y1 = height -1 + if y2 >= height: + y2 = height -1 # x1 < 0 | y1 < 0 | x2 <= 0 | y2 <= 0 if x1 < 0 or y1 < 0 or x2 <= 0 or y2 <= 0: