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

Hi, I am a beginner in using tensoflow and I want to build up an object detection android app. I need to build my own dataset to detect the object. Therefore, I would like to use pip install tflite-model-maker to make it.

However, when I run the code spec = model_spec.get(‘efficientdet_lite2’), there is an attribute error occured which says the module ‘keras.api._v2.keras.mixed_precision’ has no attribute ‘experimental’.

I have tried to reinstall different version of tensorflow, including 2.5.0, 2.8.0 and 2.9.1, but it is still in vein. I have also tried to reinstall keras and tflite-model-maker but it is still in vein again.

All of the instruction that I follow depends on Google Colab , I am really frustrated with that situation. Can anyone help me? Thank you.

1 Like

The tf.keras.mixed_precision.experimental API has been removed. The non-experimental symbols under tf.keras.mixed_precision have been available since TensorFlow 2.4 and should be used instead.

Please uninstall all existing installations of Tensorflow and keras . Only go with Tensorflow 2.9 or nightly in a new environment( Don’t install keras again in the same environment). Thank you.