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
My network accepts images of variable height and width, which can be represented by x = Input(1, None, None, 3). Invoking the vis.visualization.visualize_saliency on this network will throw the following error:
ValueError: Cannot feed value of shape (1, 3, 235, 224) for Tensor 'input_1_2:0', which has shape '(?, ?, ?, 3)'
I believe the problem is in Optimizer._get_seed_input(seed_input) (optimizer.py L95, on master), where an assumption incorrectly swaps the channel dim from its correct position to an incorrect one:
# Only possible if channel idx is out of place.ifseed_input.shape!=desired_shape:
seed_input=np.moveaxis(seed_input, -1, 1)
returnseed_input.astype(K.floatx())
For example, let's say I'm feeding an image of (423, 451, 3). seed_input.shape == (1, 423, 451, 3) != (1, None, None, 3) == desired_shape will pass and seed_input.shape will become (1, 3, 451, 423).
This can be corrected by removing this condition and assuming the user knows what to input. However, if this condition must be kept, then maybe we could make this checking more strict. Something in the lines of:
Check that you are up-to-date with the master branch of keras-vis. You can update with:
pip install git+git://github.com/raghakot/keras-vis.git --upgrade --no-deps
If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
The text was updated successfully, but these errors were encountered:
My network accepts images of variable height and width, which can be represented by
x = Input(1, None, None, 3)
. Invoking thevis.visualization.visualize_saliency
on this network will throw the following error:I believe the problem is in
Optimizer._get_seed_input(seed_input)
(optimizer.py L95, on master), where an assumption incorrectly swaps the channel dim from its correct position to an incorrect one:For example, let's say I'm feeding an image of
(423, 451, 3)
.seed_input.shape == (1, 423, 451, 3) != (1, None, None, 3) == desired_shape
will pass andseed_input.shape
will become(1, 3, 451, 423)
.This can be corrected by removing this condition and assuming the user knows what to input. However, if this condition must be kept, then maybe we could make this checking more strict. Something in the lines of:
pip install git+git://github.com/raghakot/keras-vis.git --upgrade --no-deps
The text was updated successfully, but these errors were encountered: