'Adam' object has no attribute 'Adam'

2.2k Views Asked by At

This is how I imported the modules

from keras.layers import Conv2D, BatchNormalization, Activation
from keras.models import Model, Input
from keras import optimizer_v2
from keras.optimizer_v2 import adam
import keras.backend as K

But I'm getting this Error

Error Message

I tried using adam = adam(learning_rate= 0.00001) but it doesn't work either

1

There are 1 best solutions below

0
HrugVed On

I tried the following steps and it worked

import keras
adam = keras.optimizer_v2.adam.Adam(learning_rate= 0.00001)
deblur_CNN.compile(optimizer= adam, loss= 'mean_squared_error')
deblur_CNN.load_weights('/content/drive/My Drive/Colab Notebooks/FDmodels/deblur_cnn_weights.h5')

after specifying the exact path to the adam.Adam module it worked fine. Still, if anyone wants to add something can add.