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
155 stars 33 forks source link

xml for multiple class names #8

Closed andhana closed 3 years ago

andhana commented 3 years ago

Hello @AlvaroCavalcante , this script is running well. I have multiple class names and it appears in the detected image, but I only get one class name for all bounding box in the xml file. Could you help me please? Thank you

AlvaroCavalcante commented 3 years ago

@andhana I'll be happy to help you! Your problem seems to be similar to this: https://github.com/AlvaroCavalcante/auto_annotate/issues/4#issuecomment-735710994. If you debug the visualization_utils.py file you will rapidly find the source of your problem, look at this snippet:

if new_xml != False:
      xml = generate_xml.GenerateXml(array_position, im_width, im_height, class_name, file_name)
      xml.gerenate_basic_structure()

Here is where we call the GenerateXml class, one of the parameters is the class_name of the detected object. Please, verify if the name is being correctly passed!

andhana commented 3 years ago

Thank you for your response. I already run the script exactly same with your code from github (I only change the directory path with mine), but the result is still get one class name. Any suggestion?

AlvaroCavalcante commented 3 years ago

Maybe there's a bug in the system! To discover that, I'll need you to find what part of the code the things stop to work as it should. My suggestion is that you put a print(class_name) right below this IF: https://github.com/AlvaroCavalcante/auto_annotate/blob/600406a470f400795a1010656aa222cf48dabcae/scripts/visualization_utils.py#L897.

After that, tell me what was the result of the print, if your classes are correctly printed or if the bug begins before this point! Thank you.

andhana commented 3 years ago

After I print, the result is just "person" class name. In the image bounding box is "person" and "N/A". It should be "person" and "kite".

AlvaroCavalcante commented 3 years ago

@andhana It means that your problem is not in the generate_xml.py file, which is the file responsible to create the XML file with the annotations. Maybe there's something wrong with your visualization_utils.py file. What's your TF version? Could you show me your result image? If your model is openly available, I could try to debug it for you! Thanks!

andhana commented 3 years ago

The "N/A" bounding box was fixed, I forgot to change max_num_class according .pbtxt file. But the xml file still write one class.

Thank you @AlvaroCavalcante

AlvaroCavalcante commented 3 years ago

@andhana the version that I used in my tests was the TF 1.14, but I'm not sure if this is a problem. Now that you fixed the "N/A" class, something different is being printed in the "class_name" or your unique result is still "person"? Could you upload the resulting image here so that I can check? At the weekend, I'll try to download your model and test it on my machine, but keep testing until there that you may find the bug.

AlvaroCavalcante commented 3 years ago

I'll close this issue due to inactivity, please, let me know if I could help you with something!

andhana commented 3 years ago

@andhana the version that I used in my tests was the TF 1.14, but I'm not sure if this is a problem. Now that you fixed the "N/A" class, something different is being printed in the "class_name" or your unique result is still "person"? Could you upload the resulting image here so that I can check? At the weekend, I'll try to download your model and test it on my machine, but keep testing until there that you may find the bug.

Sorry for my slow response, this is the result of image and xml. image_2 Screenshot from 2021-01-27 21-49-04 Screenshot of the xml.

AlvaroCavalcante commented 3 years ago

@andhana this is strange, in your image you are correctly getting the class names, so in the XML you should get it too. When you open your original image and the generated XML in the annotation software (LabelImage for example) it shows the class "person" and "N/A" in the kite? I'll try to use your model to simulate this issue!

andhana commented 3 years ago

I have test it on 3 different computers (all ubuntu OS), the result still appears only one class name. This is a screenshot of the printed class_name from the terminal Screenshot from 2021-02-03 16-54-57

AlvaroCavalcante commented 3 years ago

@andhana you tried to update your TensorFlow version to 1.4 or above in one of the machines? This is the version that I used. I'll download an example model and try to reproduce your error today ok? I'll give you feedback on my findings. Tanks!

AlvaroCavalcante commented 3 years ago

@andhana sorry for the late response, I was really busy. After analyse your issue I got some errors in the auto_annotate. I fixed and seems that It's all working now. I've tested using an SSD model from TF and it correctly gave me the results and annotate the files. Try again please and let me know if you have any issues!