Nagabhushan S N
Nagabhushan S N

Reputation: 7267

ResNet50v2 in Keras

I want to load pre-trained ResNet50v2 model in Keras. I tried

keras.applications.resnet_v2.ResNet50V2()

This gave an error

Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: module 'keras.applications' has no attribute 'resnet_v2'

On searching that error, this answer suggested to use keras_applications package. So I tried

keras_applications.resnet_v2.ResNet50V2()

This gives the error

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/nagabhushan/.local/lib/python3.6/site-packages/keras_applications/resnet_common.py", line 495, in ResNet50V2
    **kwargs)
  File "/home/nagabhushan/.local/lib/python3.6/site-packages/keras_applications/resnet_common.py", line 348, in ResNet
    data_format=backend.image_data_format(),
AttributeError: 'NoneType' object has no attribute 'image_data_format'

On searching that error, this answer suggests to use keras.applications package. I'm confused. How can I load ResNetv2 model?

Note: I was able to load ResNet50. Only ResNet50v2 is giving problems

from keras.applications.resnet50 import ResNet50

Upvotes: 5

Views: 4146

Answers (1)

Sebin Sunny
Sebin Sunny

Reputation: 1803

import keras

keras.applications.resnet_v2.ResNet50V2()
The above code is executed in the jupyter notebook
Before installing Keras, please install one of its backend engines TensorFlow

  • pip install tensorflow
  • pip install keras

enter image description here

Upvotes: 2

Related Questions