Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

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

Open
5hyfilm-zz opened this issue May 9, 2020 · 4 comments

Comments

@5hyfilm-zz
Copy link

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.

@Scottchou7
Copy link

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)

@5hyfilm-zz
Copy link
Author

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

@nathan60107
Copy link

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.

@jayes97
Copy link

jayes97 commented Jan 30, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants