-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upload annotated dataset via Python API raises AttributeError but upload via WebUI works fine #322
Comments
The tutorial works for me in python 3.10 and 3.11 as well. Please try upgrading your roboflow install. If it still doesn't work, please provide sample images , annotations and exact code snippet used. |
I upgraded roboflow from 1.1.43 to 1.1.44, but still get the same error. Images are simple RGB .jpg images of maximum size about ~160ko. The following code produces the error (it is the tutorial):
Part of the _annotations.coco.json file:
I thought about something: some images in the images folder does not have related annotations in the file, can this cause the problem ? Thanks for your help. |
As additional information: |
yeah Interesting. I tried to replicate the error you get and was able to.
correct annotation "images":[{"id":0,"license":1,"file_name":"f52_jpg.rf.b74946257dcd3493e38b86a9bc0fa425.jpg","height":1024,"width":1792,"date_captured":"2024-08-23T22:05:42+00:00"},{"id":1,"license":1,"file_name":"f34_jpg.rf.d84ad1992847d85e22f0dfc1b3d27392.jpg","height":1024,"width":1792,"date_captured":"2024-08-23T22:05:42+00:00"}, Incorrect annotation I manually modified the id for the second element to be zero instead of one. "images":[{"id":0,"license":1,"file_name":"f52_jpg.rf.b74946257dcd3493e38b86a9bc0fa425.jpg","height":1024,"width":1792,"date_captured":"2024-08-23T22:05:42+00:00"},{"id":0,"license":1,"file_name":"f34_jpg.rf.d84ad1992847d85e22f0dfc1b3d27392.jpg","height":1024,"width":1792,"date_captured":"2024-08-23T22:05:42+00:00"}, Now, when I run the python code i get below error. status code 500
Also, attached is the screenshot from web UI, where the file with incorrect annotation went to not annotated tab. https://app.roboflow.com/test-4h9f7/test-upload-nfbt0/annotate We need to debug the code for web app/ API endpoints to understand what is going on and why its returning 500/Unknown error' I am not able to find the code the web app/ API endpoints for annotate. Do you know where it could be? Meanwhile you might want to clean up your annotation file for any errors.(since we don't know which annotations cause issue, you might need to do manual steps by trying few images at a time :) ) |
Unfortunately, I ran a simple script to check if any image ids or annotation ids are duplicate (looking for the case you described) but I have no duplicates in my file.
I am not sure this is the real problem I have since I tried to just download a dataset and then upload it to another clean new fresh project and got the same error.
No i didnt check this. I didnt know it was os too, i'll try to find it if i have time to. |
Hey @venkatram-dev, I'm coming with news ! It seems you changed something because the "unknown error" disappeared, that's good news ! I checked all my code (seems ok), generate new annotations with and checked if any duplicates in image ids, image names or annotation ids but the script found nothing. However, I know that images and annotations with same name where previously uploaded (deleted since) to the project. Can i be caused by a conflict with images/annotations that where previously on the project ? |
Hi, I am not from roboflow team. Looks like the api code is not open source, so I did not change anything :) . Anyways, regarding your latest error "roboflow.adapters.rfapi.AnnotationSaveError: Image was already annotated." Can you please try annotation_overwrite=True option. Below code worked for me.
|
Hi, Haha, i thought you were ! Nice, thanks for the tip |
I'm trying to upload a dataset via Python API with annotations file in JSON.
But the upload fails after one image is uploaded with an Python AttributeError:
It appears that the error message returned by API call is not handled, since the real API response is:
When I try to upload the annotated dataset via the WebUI, it works fine.
How can I have further information about the error ?
Edit: I followed step-by-step the tutorial (https://docs.roboflow.com/api-reference/images/upload-an-annotation) to find if I'm doing something wrong, but get the exact same error.
The text was updated successfully, but these errors were encountered: