AlvaroCavalcante / auto_annotate

Labeling is boring. Use this tool to speed up your next object detection project!

Home Page:https://medium.com/p/acf410a600b8#9e0e-aaa30a9f4b7a

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xml for multiple class names

andhana opened this issue · comments

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

@andhana I'll be happy to help you! Your problem seems to be similar to this: #4 (comment). 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!

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?

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:

if new_xml != False:
.

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.

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".

@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!

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.

  • TF version = tensorflow-gpu==1.13.0
  • model = faster_rcnn_inception_v2_coco_2018_01_28 and ssd_mobilenet_v1_coco_2017_11_17
  • Labels = mscoco_label_map.pbtxt

Thank you @AlvaroCavalcante

@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.

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

@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.

@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!

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

@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!

@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!