keras-team/keras-applications

AttributeError: module 'tensorflow.keras.applications' has no attribute 'EfficientNetB0'

5hyfilm-zz opened this issue · 4 comments

In the doc has EfficientNet but cannot use it. When I coding it show me an error AttributeError: module 'tensorflow.keras.applications' has no attribute 'EfficientNetB0' .

I use TensorFlow 2.2.0 and Keras 2.3.0 on Google Colab.

I think they not done this EfficientNe yet or they had done but not published because I go to Tensorflow and Keras repository, I didn't found the code.

You can try to copy "efficientnet.py" file in your local "keras_applications" folder. For example I use anaconda to build keras project: C:\user\AppData\Local\conda\conda\envs\Your Environment Name\Lib\site-packages\keras_applications.

from keras_applications.efficientnet import EfficientNetB0
model = EfficientNetB0(
weights='imagenet',
include_top=False,
input_shape=(128, 128, 3),
backend=keras.backend,
layers=keras.layers,
models=keras.models,
utils=keras.utils)

@Scottchou7 I didn't see it, it doesn't in the library

Please look at tf doc, it is only available in tf-nightly of tf 2.2.
So if your tf is not nightly, you cannot find it.

install efficientnet in you env
!pip install keras-efficientnet

then you can import model as

import efficientnet.tfkeras as efc

done...
you can use prefix 'efc' for B0-B7