keras-applications icon indicating copy to clipboard operation
keras-applications copied to clipboard

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

Open 5hyfilm-zz opened this issue 4 years ago • 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.

5hyfilm-zz avatar May 09 '20 09:05 5hyfilm-zz

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 avatar May 11 '20 07:05 Scottchou7

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

5hyfilm-zz avatar May 13 '20 15:05 5hyfilm-zz

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.

nathan60107 avatar Jun 26 '20 04:06 nathan60107

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

jayes97 avatar Jan 30 '21 08:01 jayes97