Home > Mobile >  How can I import resnet_rs module from keras?
How can I import resnet_rs module from keras?

Time:08-16

I was trying to import resnet_rs module from keras. But counldn't find a way to do it via keras.applications. Using tensorflow 2.8

I tried the following:

from tensorflow.keras.applications.resnet_rs import ResNetRS50

Got no module error.

Then I tried to use it via api, again got error

tf.keras.applications.resnet_rs.ResNetRS50(
    include_top=True,
    weights='imagenet',
    classes=1000,
    input_shape=None,
    input_tensor=None,
    pooling=None,
    classifier_activation='softmax',
    include_preprocessing=True
)

So, how can I import resnet_rs? (as we do for other resnet import) Any suggestions or pointers will be appreciated.

CodePudding user response:

What version of Tensorflow are you on? I was on Tensorflow 2.8.2 and it wasn't working for me either. I switched to 2.9.1, and it fixed the import. I think those modules were added only recently. That's why previous versions won't work.

To upgrade to the latest version:

pip install tensorflow --upgrade

CodePudding user response:

Checkout the official documentation here and it being used in a guide here

You can call it through the following -

tf.keras.applications.resnet.ResNet50 or tf.keras.applications.ResNet50

  • Related