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.applications import MobileNet
There is also MobileNetV2
in the same package for a newer version of MobileNet.
Post a Comment for "ImportError: Cannot Import Name 'relu6' And AttributeError: Module 'keras.applications.mobilenet' Has No Attribute 'relu6'"