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
The only lines I have modified in the example are:
# From our repository.
import saliency.core as saliency
and
# Load the image
im_orig = LoadImage('./doberman.png')
as
# From our repository.
try:
import saliency.core as saliency`
except:
! pip install saliency
import saliency.core as saliency`
and
# Load the image
im_orig = LoadImage('../input/saliency-imgs/doberman.png')
Also, I have seen there was an issue (#5) created for the code examples to be adapted to TF2. But since the current title of the examples states "for TF2 and other frameworks" I assume the code was finally adapted, and this issue isn't relevant anymore for the problem I am describing.
Thank you.
The text was updated successfully, but these errors were encountered:
Yes it looks like your version of the image has an extra alpha layer (RGBA image rather than RGB). You could do as @joydisette suggested above (convert to JPG, or convert to a PNG with no alpha/transparency layer). Alternatively, you could remove the extra alpha channel from the numpy array directly:
im_rgba = LoadImage('../input/saliency-imgs/doberman.png') im_rgb = im_rgba[:,:,:3] im = PreprocessImage(im_rgb)
Let us know if you are still having issues. Thanks!
Hi, I am running the core example code for Vanilla Gradient & SmoothGrad on a Kaggle notebook, and I get the error below:
ValueError Traceback (most recent call last)
in
6 ShowImage(im_orig)
7
----> 8 _, predictions = model(np.array([im]))
9 prediction_class = np.argmax(predictions[0])
10 call_model_args = {class_idx_str: prediction_class}
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
996 inputs = self._maybe_cast_inputs(inputs, input_list)
997
--> 998 input_spec.assert_input_compatibility(self.input_spec, inputs, self.name)
999 if eager:
1000 call_fn = self.call
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
272 ' is incompatible with layer ' + layer_name +
273 ': expected shape=' + str(spec.shape) +
--> 274 ', found shape=' + display_shape(x.shape))
275
276
ValueError: Input 0 is incompatible with layer model_1: expected shape=(None, 224, 224, 3), found shape=(1, 224, 224, 4)
Here is the kaggle notebook with the error.
The only lines I have modified in the example are:
and
as
and
Also, I have seen there was an issue (#5) created for the code examples to be adapted to TF2. But since the current title of the examples states "for TF2 and other frameworks" I assume the code was finally adapted, and this issue isn't relevant anymore for the problem I am describing.
Thank you.
The text was updated successfully, but these errors were encountered: