Home > other >  AttributeERROR : module'tensorflow.keras.applicationsas no attribute efficientnet_v2
AttributeERROR : module'tensorflow.keras.applicationsas no attribute efficientnet_v2

Time:11-12

When i try to run the efficientNetv2 model I got this erreur enter image description here

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

Tensorflow version : tensorflow-gpu:2.6

CodePudding user response:

A similiar question has already been asked here, some of the solutions may work for you. ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'

My recommendation: Uninstall and install tensorflow. I checked with the latest version, you should be able to access the module.

What I also noticed that you use from tensorflow.keras import applications to load module, then you use tf to refer to the said module and tf is not defined among imports. try calling the model directly from applications

CodePudding user response:

The import is incorrect, you need to update it, it might have worked in older Keras versions,but the internal per-network modules inside keras.applications are not exposed anymore, so your correct import would be:

keras.applications.EfficientNetV2S

Or if you use tf.keras:

tf.keras.applications.EfficientNetV2S

For future reference, always check the documentation, for EfficientNetV2S the link is here.

  • Related