Closed Andres-San closed 1 year ago
Thanks @laxmareddyp
I've come to the conclusion that is not a TensorFlow issue, its about sagemaker not being crystal-clear on the annotations format so parsing from sagemaker to TF is not clear enough. I've posted the detail here #3853, if someone is interested.
Also, not even sagemaker examples object detection works for me at least, so that is another hint in the same direction, #3852.
Best!
Thanks for quick response and closing this as completed.if you would like to discuss further, please feel free to reopen the issue here.
1. The entire URL of the file you are using
https://github.com/tensorflow/models/blob/master/research/object_detection/core/box_list.py
2. Describe the bug
Hi there, nice to meet you all,
Context [aws-sagemaker-object detection]
I've been trying to train an Object Detection Model (using Built-in Algoritms, Tensorflow) following the jumpstart sagemaker examples as template, but as soon as I provide a null annotation sagemaker fails to train when calling fit(), and throws the following error directly from tensorflow (at the end of the post is the entire traceback)
File "/opt/ml/code/object_detection/core/box_list.py", line 55, in __init__ raise ValueError("Invalid dimensions for box data: {}".format(boxes.shape)) ValueError: Invalid dimensions for box data: (0,)
Great!, So what the issue here? If I provide a dataset with equal n° of images and annotations, thats great and I can train sucessfully my model, but if I have an image with no object in it, the error raises, for instance:
0001.jpeg 1 has object and the corresponding annotation
0002.jpeg has no object, so it doest have an annotation
So the annotation.json file looks like:
{ "images": [ { "file_name": "0001.jpeg", "height": 1944, "width": 2592, "id": "0001" }, { "file_name": "0002.jpeg", "height": 1944, "width": 2592, "id": "0002" } ], "annotations": [ { "image_id": "0001", "bbox": [ 688, 371, 1859, 1581 ], "category_id": 0 } ] }
As far as i could investigate, this is the standrad proccedure when no object is available, I've also downloaded an entire annotation coco dataset 2017 to make sure of this (you can download "2017 Train/Val annotations [241MB]" and search of instances_val2017.json and look for files with ID 25593, 41488, 42888 ... and you'll see that there are the images ones, but not the annotations ones)
3. Steps to reproduce
Train any object detection garden model with these annotation files
{ "images": [ { "file_name": "0001.jpeg", "height": 1944, "width": 2592, "id": "0001" }, { "file_name": "0002.jpeg", "height": 1944, "width": 2592, "id": "0002" } ], "annotations": [ { "image_id": "0001", "bbox": [ 688, 371, 1859, 1581 ], "category_id": 0 } ] }
4. Expected behavior
Should not raise an error when no annotations are available for certain image
5. Additional context
6. System information