1

I am executing below mentioned code on colab.

from tensorflow.keras_applications.imagenet_utils import _obtain_input_shape

_obtain_input_shape was imported successfully a few days back but now it is giving me following error.

ModuleNotFoundError: No module named 'tensorflow.keras_applications'

Colab is using keras version 2.4.3 and tensorflow version 2.3.0 .

So i changed the above code to

from tensorflow.keras.applications.imagenet_utils import _obtain_input_shape

Still i get the following error ImportError: cannot import name '_obtain_input_shape'

How do i get _obtain_input_shape without downgrading the keras and tensorflow version.

1 Answers1

0

You need to install keras-applications in your system and then run

from keras_applications.imagenet_utils import _obtain_input_shape

or

from keras.applications.imagenet_utils import _obtain_input_shape

based on your Keras version. See this

ahmadi
  • 17
  • 7