rafaelpadilla / review_object_detection_metrics

Object Detection Metrics. 14 object detection metrics: mean Average Precision (mAP), Average Recall (AR), Spatio-Temporal Tube Average Precision (STT-AP). This project supports different bounding box formats as in COCO, PASCAL, Imagenet, etc.
Other
1.08k stars 215 forks source link

Bug in the converter.py while looking for images folder ? #125

Closed kikdu closed 1 year ago

kikdu commented 1 year ago

Hello,

I am not sure if it is a bug or not (maybe I am doing something wrong) but that's how you can reproduce it :

file structure :

There is no problem while using the UI with the following config => annotations GT = ground_truth_converted / images = ground_truth_images / classes = classes.txt / yolo(.txt) / annotations DET = yolov7_converted / classes = classes.txt / <class id confidence left top width height (RELATIVE)>.

But there is a problem when I use it with the following config => annotations GT = ground_truth_converted / images = ground_truth_images / classes = classes.txt / yolo(.txt) / annotations DET = mot_converted / classes = classes.txt / <class id confidence left top width height (RELATIVE)>.

I get the warning "Warning: Image not found in the directory None. It is required to get its dimensions".

In converter.py line 269. the following code returns None :

general_utils.find_image_file(img_dir, img_filename + file_suffix)

It is weird because the file structure is exactly the same in both cases and the files contained in those folders are similar too.

I fixed my problem by hardcoding the img_size in converter.py line 269 (because my images are always 256x256) :

img_size = (256,256)
# If coordinates are relative, image size must be obtained in the img_dir
# if type_coordinates == CoordinatesType.RELATIVE:
#     img_path = general_utils.find_image_file(img_dir, img_filename + file_suffix)
#     if img_path is None or os.path.isfile(img_path) is False:
#         print(
#             f'Warning: Image not found in the directory {img_path}. It is required to get its dimensions'
#         )
#         return ret
#     resolution = general_utils.get_image_resolution(img_path)
#     img_size = (resolution['width'], resolution['height'])
for line in f:

It is now working correctly and the tool is finding all bounding boxes and runs perfectly.

It is however a lazy fix that works for me but I'm posting this just in case it can help someone.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.