Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations are not generated #73

Open
karthyyy opened this issue Mar 17, 2024 · 5 comments
Open

Annotations are not generated #73

karthyyy opened this issue Mar 17, 2024 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@karthyyy
Copy link

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

@karthyyy karthyyy added the question Further information is requested label Mar 17, 2024
Copy link

Thanks for contributing this issue! We will be replying soon.

@AlvaroCavalcante
Copy link
Owner

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

@karthyyy
Copy link
Author

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

@ZK108
Copy link

ZK108 commented Nov 5, 2024

hello @karthyyy,

I want to use it for a custom Yolov8 model, and I'd like to know your experience with Yolov5. was it successful?

thanks

@karthyyy
Copy link
Author

karthyyy commented Nov 7, 2024

Hi @ZK108,

No. I went behind that for sometime and left it without much success. In between my work priorities also got changed. I am planning to restart it shortly. All the best for your work.

Regards
Karthik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants