Tensorflow Custom Object Detection Codelab Notebook not working

I am using the code from codelab but using it in spyder(anaconda).

spec = model_spec.get('efficientdet_lite0')

when I run the above line of code it gives the following error.

AttributeError: module ‘keras.api._v2.keras.mixed_precision’ has no attribute ‘experimental’

Here is the link for the codelab notebook Google Colab

Any solutions

@khanhlvg Can you help?

The latest version of Model Maker (0.4.1) isn’t compatible with the latest version of TF (2.9). We’re working on resolving the issue and hopefully will release a new version of Model Maker soon!

@Abdullah_Ilyas
It’s better to start learning a clean API, KerasCV object detection.. Already support latest tensorflow.

I’m still using an older version of Model Maker (0.3.4) is there a way we can continue to use these legacy versions of Model Maker in Colab? anyone got a Colab work around?

(my App has been crashing since TF2.6 had the switch of output orders Salad Detection Model Crashing Android App - #8 by Yuqi_Li)

Once the next version (0.4.2) of Task Lib and Model Maker is released, you shouldn’t have the crash problem if you retrain your model with the latest version of Model Maker and integrate it using the latest version of Task Library.

1 Like

Sounds good :slight_smile: patience is usually the answer with almost all of my questions.

To confirm when we’re talking about the latest version of Task Library we’re talking about tensorflow-lite-task-vision:0.4.0 (or 0.4.1) correct?

implementation 'org.tensorflow:tensorflow-lite-task-vision:0.4.0

I mean 0.4.2. We just released Task Library v0.4.2 today. It’ll take a bit more for Model Maker 0.4.2 to be released.

1 Like

@khanhlvg !
Will the issue mentioned below be solved in the new version of tflite-model-maker

module ‘keras.api._v2.keras.mixed_precision’ has no attribute ‘experimental"

What is the expected release date?

Thanks @khanhlvg for letting me know. Just had a successful training session :slight_smile:

If anyone is Googling at a later date the below issue is solved by using tflite-moderl-maker-nightly

module ‘keras.api._v2.keras.mixed_precision’ has no attribute ‘experimental"

This is using TF 2.8.2

Can also vouch for updating your Android app dependency to

implementation 'org.tensorflow:tensorflow-lite-task-vision:0.4.1'

Always good to stay up to date with these things (unlike my usual practise) :wink:

Thanks alot @wwfisher !
Really appreciate it!

zero thanks to me, all the thanks to @khanhlvg et al.

@wwfisher !
It is working fine now. Model is working fine but I can’t draw detection boxes around detected objects.
I have tried many things from different internet resources but nothing seems to work.
could you please suggest me some good resource to do so
Thank you!

This is the tutorial that I like a lot

Specifically you’ll be looking at step 6 (#'s start at 0)

All the code is clearly commented in MainActivity.kt so is pretty straight forward to follow/adapt.

Credit for this again goes to @khanhlvg