def getGradCAM(X, model, resize_factor=0, layer_maps=-4):
# Create functions ----------
# GRAD - backprop
# create function
model = guided(model)
saliency = K.gradients(K.sum(model.outputs[-1]), model.layers[layer_maps].output)
pooled = K.mean(saliency[0], axis=range(len(saliency[0].shape) - 1))
grad = K.function([model.layers[0].input], [pooled])
the problem is at the first line, here is the error:
_Traceback (most recent call last):
File "/code/run_prediction.py", line 8, in
from attention_computation import getCAM, getGradCAM, getGradOrGuidedBackprop
File "/code/attention_computation.py", line 5, in
from vis.backprop_modifiers import guided
File "/usr/local/lib/python3.6/dist-packages/vis/backprop_modifiers.py", line 4, in
from . import backend
File "/usr/local/lib/python3.6/dist-packages/vis/backend/init.py", line 1, in
from keras import backend as K
File "/usr/local/lib/python3.6/dist-packages/keras/init.py", line 20, in
from . import initializers
File "/usr/local/lib/python3.6/dist-packages/keras/initializers/init.py", line 124, in
populate_deserializable_objects()
File "/usr/local/lib/python3.6/dist-packages/keras/initializers/init.py", line 82, in populate_deserializable_objects
generic_utils.populate_dict_with_module_objects(
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_moduleobjects'
Hello everyone, I'm running into this issue
the problem is at the first line, here is the error:
_Traceback (most recent call last): File "/code/run_prediction.py", line 8, in
from attention_computation import getCAM, getGradCAM, getGradOrGuidedBackprop
File "/code/attention_computation.py", line 5, in
from vis.backprop_modifiers import guided
File "/usr/local/lib/python3.6/dist-packages/vis/backprop_modifiers.py", line 4, in
from . import backend
File "/usr/local/lib/python3.6/dist-packages/vis/backend/init.py", line 1, in
from keras import backend as K
File "/usr/local/lib/python3.6/dist-packages/keras/init.py", line 20, in
from . import initializers
File "/usr/local/lib/python3.6/dist-packages/keras/initializers/init.py", line 124, in
populate_deserializable_objects()
File "/usr/local/lib/python3.6/dist-packages/keras/initializers/init.py", line 82, in populate_deserializable_objects
generic_utils.populate_dict_with_module_objects(
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_moduleobjects'