8

I am trying to run an image-based project on colab. I found the project on github. Everything runs fine till I reached the cell with the following code:

import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.applications.resnet50 import preprocess_input, ResNet50
from keras.models import Model
from keras.layers import Dense, MaxPool2D, Conv2D

When I run it, the following output is observed:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-24-173cbce466d6> in <module>()
      1 import keras
      2 from keras.preprocessing.image import ImageDataGenerator
----> 3 from keras.applications.resnet50 import preprocess_input, ResNet50
      4 from keras.models import Model
      5 from keras.layers import Dense, MaxPool2D, Conv2D

ModuleNotFoundError: No module named 'keras.applications.resnet50'

---------------------------------------------------------------------------

It's running 2.7.0 keras, connected to a TPU runtime. I tried !pip installing the said module but no use. I even tried running a demo resnet50 project too but got the same error. Can anyone please help me solve the error?

Anonymous
  • 83
  • 1
  • 1
  • 4
  • Does this answer your question? [I am not able to import resnet from keras.applications module](https://stackoverflow.com/questions/54682539/i-am-not-able-to-import-resnet-from-keras-applications-module) – Shaida Muhammad Feb 14 '22 at 11:22
  • I tried this, not luck. Only then i asked the question. – Anonymous Feb 15 '22 at 12:51

1 Answers1

9
from tensorflow.keras.applications.resnet50 import ResNet50
Jafar Isbarov
  • 1,363
  • 1
  • 8
  • 26
  • I tried it and got this error: ------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in () 1 import keras 2 from keras.preprocessing.image import ImageDataGenerator ----> 3 from tf.keras.applications.resnet50 import ResNet50 4 from keras.models import Model 5 from keras.layers import Dense, MaxPool2D, Conv2D ModuleNotFoundError: No module named 'tf' --------------------------------------------------------------------------- – Anonymous Feb 15 '22 at 18:01
  • I updated the answer. Also, make sure you installed tensorflow first. @Anonymous – Jafar Isbarov Feb 15 '22 at 18:22