AlvaroCavalcante / auto_annotate

Labeling is boring. Use this tool to speed up your next object detection project!
https://medium.com/p/acf410a600b8#9e0e-aaa30a9f4b7a
Apache License 2.0
156 stars 32 forks source link

XML generated are distorted when opened in LabelImg annotation tool #5

Closed DeepakShanthaiah closed 3 years ago

DeepakShanthaiah commented 3 years ago

Hello @AlvaroCavalcante , Thanks for your previous responses. I have encountered new problem i.e, after generating the XML files when I try to open the folder which has image and its xml file in LabelImg tool ,I can see the bounding boxes with right co-ordinates but it is not annotated on the right part it is distorted in the image.

Example : if there are classes A,B,C I can see three bounding boxes when I open in LabelImg tool but all those 3 boxes are not annotated on the particular part . It is like bounding boxes are drawn but not on that particular part.

So this makes life tough again re-arranging the boxes by checking which class does the box belongs to .

I will be glad if you can help me resolve this issue , so I can post all the new changes that I did to get the better results which will help others who are facing same issues.

AlvaroCavalcante commented 3 years ago

@DeepakShanthaiah I already had this problem, but I thought that was fixed. This is probably happening because the proportion of the image is not the same as the XML in the generation process. To confirm this hypothesis, check your output JPG file, the generated bounding boxes are in the correct positions?

Your problem may be here: https://github.com/AlvaroCavalcante/auto_annotate/blob/d08e728047ba3374bd414f7d2427746811687895/scripts/visualization_utils.py#L858

In this line of code, the bounding box position is set, but if for some reason your im_width/height is not correct, the proportion of the box will not be correct.

Please, let me know about your findings!

DeepakShanthaiah commented 3 years ago

Hello @AlvaroCavalcante ,The result folder where I get the output image in that the bounding boxes are exactly on the part. Also, the co-ordinates of the bounding boxes fits exactly when I drag that bounding box on the particular part in LabelImg tool and this is tedious task to drag and place that bounding boxes everytime for multiple class.If it gets auto annotated on the part itself if not 100% atleast 90% of that part it will help us .

I did went through that line and I am not able to figure out why is this issue.

If the bounding boxes in output jpg image is perfect then why is it generating XML file with distorted localization of annotation. I guess something is going wrong while writing XML file.

Any alternative suggestion you can help me with to tackle this ?

DeepakShanthaiah commented 3 years ago

@AlvaroCavalcante , I just tried checking the proportion of image: In my input image : width =640 and height =480 In Xml file which is generated the width and height are same as above but the output image in result folder has width =636 and height = 482, so here is the issue I believe. What should I do to overcome this ?

AlvaroCavalcante commented 3 years ago

@DeepakShanthaiah don't worry, we'll solve your problem! Well, I've done the following test:

Important detail - please, note that your XML and JPG MUST have the same name, not only in the file but inside the tag in XML, here is my working example:

image

And inside the XML file: image

If you have trouble with the file name, let me know, I already implemented a solution to solve this, passing the same name to the image and XML file inside generate_xlm class.

AlvaroCavalcante commented 3 years ago

@DeepakShanthaiah I've added an update on branch master to get the XML name automatically based on the JPG filename.

DeepakShanthaiah commented 3 years ago

Hello @AlvaroCavalcante , Thanks for your response . The issue is resolved and it helped me reduce my time in annotating.

AlvaroCavalcante commented 3 years ago

@DeepakShanthaiah Good news! If you have any other problems, feel free to report. I'll close this issue now.