Importerror: Cannot Import Name 'relu6' And Attributeerror: Module 'keras.applications.mobilenet' Has No Attribute 'relu6'
I am trying to convert a h5 keras model to a .mlmodel file type, using this code: from keras.models import load_model import keras from keras.applications.mobilenet import MobileNe
Solution 1:
The code you have is for an older Keras version, the latest Keras I checked (2.2.2) has the ReLU and DepthWiseConv2D already integrated inside keras.layers
, so you only need to impor this to use MobileNet:
import keras
from keras.applicationsimportMobileNet
There is also MobileNetV2
in the same package for a newer version of MobileNet.
Baca Juga
- How To Convert Rgb Images To Grayscale, Expand Dimensions Of That Grayscale Image To Use In Inceptionv3?
- Typeerror: '>' Not Supported Between Instances Of 'nonetype' And 'float'
- I Use Tfliteconvert Post_training_quantize=true But My Model Is Still Too Big For Being Hosted In Firebase Ml Kit's Custom Servers
Post a Comment for "Importerror: Cannot Import Name 'relu6' And Attributeerror: Module 'keras.applications.mobilenet' Has No Attribute 'relu6'"