Hi,
I cannot upload the annotated files for the images. The annotated files are in txt format. I have also tried uploading XML format. It did not happen. It’s not even taking the files, and not annotating the images.
Am I doing something wrong. Please let me know if any more info is needed for resolving this issue
Please share the following so we may better assist you:
Project type (Object detection, Classification, Polygon, etc.): Object detection
The operating system & browser you are using and their versions: Windows (doesn’t matter)
The screenshot of the error being triggered in your browser’s developer tools/console. Please copy/paste the url below to watch how to pull up your devtools
Whenever I’ve had trouble with uploading annotation files, it’s usually because they were formatted wrong or were referencing image file names or file paths that were different from what is being uploaded.
Can you check whether the filename in your annotation file and the file name in your uploaded Roboflow image match? Also, check if the file path references an image that’s actually there when it’s uploading. (I’m not sure if Roboflow uses this to match image files, but it might be good to check)
You can check the image name in a Pascal VOC XML here:
<annotation>
<filename>** the name of the file should be here **</filename>
<path>** the path of the file should be here **</path>
*rest of the annotation file ...*
and check the image name on an uploaded Roboflow image under the “Attributes” tab:
If that doesn’t solve your issue, did you manually create the annotation files yourself or were they created in a different app or website? (if so what was that app or website) If you could also send the text contents of the annotation files, that might be helpful for troubleshooting.
That looks to be the YOLO Darknet TXT format. I found this GitHub issue and it looks like that format uses the ratio of the images, not the pixel measurements.
<x> <y> <width> <height> - float values relative to width and height of image, it can be equal from (0.0 to 1.0)
for example: <x> = <absolute_x> / <image_width> or <height> = <absolute_height> / <image_height>
For your first annotation’s x value, for example, would need to be 58 / *image width*
So, to fix your annotations, you would need to divide your values by the image width or image height.
For YOLO Darknet TXT, be sure you include a darknet.labels file to ensure your labels have the correct names. This is what is referred to as a “labelmap”: What is a Label Map?
I missed a part of the format when I sent the initial post. The Darknet TXT format takes in X and Y coordinates at the center of the annotation, not the top left.
Meaning, the calculation for X, for example, should be: (I’m taking xc to mean centered x)
xc = ( x + (annotation_width/2) ) / image_width
I’m not sure where you got the corrected annotations, but when I did the calculations from the first annotation, the values you sent at the bottom, it should be:
xc = (58+(427/2))/1280
xc = 0.212109375
It’s not exactly what your correct X value was, which is why I said I’m not sure where you got them from, but it’s close so I hope this helps solve your issue.
For annotation my dataset is in Pascal VOC format, as shown below:
1 58 78 427 627
1 440 84 813 627
1 822 86 1257 633
1 70 636 593 1175
1 608 644 1251 1183
1 60 1194 703 1735
1 718 1190 1253 1741
Here there are 7 lines, which means 7 different annotations are present. Let’s consider the first line.
→ ‘1’ represents the name of the annotation
→ ‘58’ represents xmin, ‘78’ represents ymin, ‘427’ represents xmax, and ‘627’ represents ymax.
→ We also need to know the width and height of the actual image (not the annotated one).
For this it was 1280x1826.
What we want is Xc, Yc, width and height from xmin, xmax,ymin,ymax, height_of_image, width_of_image, as shown in the figure below: