umautobots / vod-converter

Convert between visual object detection datasets
MIT License
307 stars 93 forks source link

Image has out of bounds bounding boxes #22

Open pranavpawar3 opened 5 years ago

pranavpawar3 commented 5 years ago

I am working on Stanford drone dataset. I have converted the dataset to KITTI format using these scripts. https://github.com/rockkingjy/DataFormat_sdd2kitti After conversion, I tried conversion from kitti format to VOC, but I am constantly getting this error. `Traceback (most recent call last): File "vod_converter/main.py", line 92, in filter_images_without_labels=args.filter_images_without_labels)) File "vod_converter/main.py", line 40, in main filter_images_without_labels=filter_images_without_labels) File "/home/pranav/vod_converter/vod_converter/converter.py", line 134, in convert validate_image_detections(image_detections) File "/home/pranav/vod_converter/vod_converter/converter.py", line 153, in validate_image_detections raise ValueError(f"Image {image} has out of bounds bounding box {detection}") ValueError: Image {'id': '1758', 'path': '/home/pranav/test_training/annotation0/training/image_2/1758.png', 'segmented_path': None, 'width': 1424, 'height': 1088} has out of bounds bounding box {'label': 'Pedestrian', 'left': 231.0, 'right': 282.0, 'top': 1078.0, 'bottom': 1088.0}

` Can you please guide me through this? Why am I getting this error and how to solve it.

krosaen commented 5 years ago

The code is sanity checking the detections:

        for detection in image_detection['detections']:
            if detection['right'] >= image['width'] or detection['bottom'] >= image['height']:
                raise ValueError(f"Image {image} has out of bounds bounding box {detection}")

it looks like a detection is overlapping the bottom of the image (zero based indexing, having a bottom of 1088 is over the max of 1087 which is height - 1). so perhaps you could double check the code that outputs the detections to make sure the dimensions are zero based?