auto_annotate
auto_annotate copied to clipboard
Annotations are not generated
Hi,
I am trying to auto annotate a set of custom images. The initial mode is trained using 'Ultralytics Yolov5s' and saved_model is generated. When I try executing the following code
from auto_annotate import AutoAnnotate
ann_tool = AutoAnnotate(
saved_model_path = './saved_model',
label_map_path = './label_map.pbtxt',
images_path = './dataset_images',
xml_path = './dataset_labels',
detection_threshold = 0.65)
ann_tool.generate_annotations()
Following messages are displayed in the terminal
_Python inputs incompatible with input_signature: inputs: ( tf.Tensor( [[[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]
[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]
[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]
...
[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]
[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]
[[0 0 0] [0 0 0] [0 0 0] ... [0 0 0] [0 0 0] [0 0 0]]]], shape=(1, 640, 640, 3), dtype=uint8)) input_signature: ( TensorSpec(shape=(1, 640, 640, 3), dtype=tf.float32, name=None))._
There are no annotations generated in the 'dataset_labels' folder. Can you please help with the same ?
Regards Karthik
Thanks for contributing this issue! We will be replying soon.
Hello @karthyyy, thank you for your interest in using this project, I hope I can help you with your doubts.
First, did you create your saved_model using TensorFlow? Other libraries were not tested and may not be completely compatible.
Second, does your Yolo model expect annotations in Pascal VOC (XML) format? Usually, the family of Yolo models uses TXT annotations, which are not compatible with the format generated in this project.
Finally, analyzing your error message, it seems that your input images are in a different format than expected by your model. As you can see, the input image has a dtype=uint8 and your model is expecting a dtype=tf.float32. Converting the image to the correct format would probably work for you.
You can do this easily by cloning this repository and changing the following line: https://github.com/AlvaroCavalcante/auto_annotate/blob/a1f2c464a2a4a0903af6ad160213de9b040da953/src/auto_annotate.py#L58C17-L58C75
Hi @AlvaroCavalcante ,
Thanks for the response..
First, did you create your saved_model using TensorFlow? Other libraries were not tested and may not be completely compatible.
I have created the model using ultralytics tools. Once the model was trained, it is exported into different formats including Tensorflow saved_model using their scripts itself (which I believe is well tested).
Second, does your Yolo model expect annotations in Pascal VOC (XML) format? Usually, the family of Yolo models uses TXT annotations, which are not compatible with the format generated in this project.
Yes. The initial model was trained using Pascal VOC annotations.
Finally, analyzing your error message, it seems that your input images are in a different format than expected by your model. As you can see, the input image has a dtype=uint8 and your model is expecting a dtype=tf.float32. Converting the image to the correct format would probably work for you.
I will check this and revert.
Regards Karthik