Classes in edge exportable object detection models

36 views
Skip to first unread message

Nicolais Guevara

unread,
Jul 9, 2020, 5:55:47 PM7/9/20
to cloud-vision-discuss
Hi,

Can we export the list of classes of an object detection model trained in google AutoML?   I have trained several edge exportable object detection models and I am able to export the pb files, however I can not get the list of classes and the mapping table between the 'detection_classes' and the 'detection_classes_as_text' from the output of the pb file.  If we use the google object detection API we have to provide the file labelmap.pbtxt with the list and order of the classes. Since we do not have to provide a similar file to train an object detection model in google AutoML, I was expecting to have an exportable file with this information. Any comment on this topic? 

Nicolais

Harshit Dwivedi

unread,
Jul 9, 2020, 6:07:08 PM7/9/20
to Nicolais Guevara, cloud-vision-discuss
Hey Nicolais!
If you export the tflite model, you should be getting a dict.txt file containing the labels along with the model.
You can then use the classes present in the dict file for mapping the output results of your saved_model.

Can you check to see if that helps?


--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Cloud Vision Discussion Google Group (cloud-visi...@googlegroups.com) to participate in discussions with other members of the Google Cloud Vision community and the Google Cloud Vision Team.
---
You received this message because you are subscribed to the Google Groups "cloud-vision-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-vision-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-vision-discuss/f547dedf-405c-4093-b6a3-49945adee7e4n%40googlegroups.com.

Nicolais Guevara

unread,
Jul 10, 2020, 4:12:01 PM7/10/20
to cloud-vision-discuss

Hi Harshit,

Thank you for your answer. I tried it and it worked great. The only question I have is about the content of the dict.txt file. In the following this link:
they explain that each line in the label file dict.txt represents a label of the predictions returned by the TensorFlow Lite model, in the same order they were requested. For example, the dict.txt for the salad dataset is as follows:
background
Baked Goods
Salad
Cheese
Seafood
Tomato

However, the salad dataset does not contain "background" as a label. Usually for classification  we have only the labels, but for object detection, it also contains the "background" line. Do I have to ignore this line in the dict.txt file? 

Best,

Nicolais

Harshit Dwivedi

unread,
Jul 12, 2020, 1:39:06 AM7/12/20
to Nicolais Guevara, cloud-vision-discuss
Hm, I'm not exactly sure.
I would recommend that you try running the inference with and without the background class and see which works correctly.
AFAIK, the background label is mapped to the output as well so you might need to keep it there.
Reply all
Reply to author
Forward
0 new messages