You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have problem with using Attentions visualization (GradCam++ in that case). I have preprocessing layer in my model, which rescales images like that: layers.Rescaling(1./255, input_shape=(constants.IMG_HEIGHT, constants.IMG_WIDTH, 3)),
The problem is, when I directly load images to visualize, I get the following error:
Traceback (most recent call last):
File "predict_2.py", line 52, in <module>
cam = gradcam(score, X, penultimate_layer=-1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "lib/python3.11/site-packages/tf_keras_vis/gradcam_plus_plus.py", line 106, in __call__
score_values = tf.reshape(score_values, score_values.shape + (1, ) * (grads.ndim - 1))
^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ndim'
But when I rescale them before visualizing, I got no error, but visualizations seems to not work correctly, heatmap is plain and doesn't show any attention maps, example at the bottom.
My code for loading images for visualizations (taken and customized from examples in docs):
Hello, I have problem with using Attentions visualization (GradCam++ in that case). I have preprocessing layer in my model, which rescales images like that:
layers.Rescaling(1./255, input_shape=(constants.IMG_HEIGHT, constants.IMG_WIDTH, 3)),
The problem is, when I directly load images to visualize, I get the following error:
But when I rescale them before visualizing, I got no error, but visualizations seems to not work correctly, heatmap is plain and doesn't show any attention maps, example at the bottom.
My code for loading images for visualizations (taken and customized from examples in docs):
And when i do like
X = images/255
there is no error, but the heatmap is plain, like this:Should I stop using resacling layer, or there is another way to load images for that case?
The text was updated successfully, but these errors were encountered: