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
I have a custom model that takes two input images and decides whether images are the same or different. I am facing problem to pass multiple inputs. My model architecture is as follows:
The model takes two inputs and extract features using the encoder network. Both features merged and then the rest of the network decides the images are the same or not. I have tried the following code:
import numpy as np
from keras.models import load_model
import keras.backend as K
import matplotlib.cm as cm
from vis.utils import utils
from vis.visualization import visualize_cam
model = load_model('model.h5', compile=False)
img1 = utils.load_img('/path/image1.jpg', target_size=(256, 256))
img2 = utils.load_img('/path/images2.jpg', target_size=(256, 256))
penultimate_layer = utils.find_layer_idx(model, 'mnet_conv2')
layer_idx = utils.find_layer_idx(model, 'fc4')
for i, img in enumerate([img1, img2]):
grads = visualize_cam(model,
layer_idx,
filter_indices=1,
seed_input=img,
penultimate_layer_idx=penultimate_layer)
I am receiving the following error:
ValueError: slice index 1 of dimension 2 out of bounds. for 'strided_slice' (op: 'StridedSlice') with input shapes: [?,1,1], [3], [3], [3] and with computed input tensors: input[1] = <0 0 1>, input[2] = <0 0 2>, input[3] = <1 1 1>
I am looking for a way to pass two images and plot the heatmaps on both images. Or even, if possible, modify the network architecture to process images one by one. I just want to visualize for a given image, where the network is focusing.
The text was updated successfully, but these errors were encountered:
I have a custom model that takes two input images and decides whether images are the same or different. I am facing problem to pass multiple inputs. My model architecture is as follows:
The model takes two inputs and extract features using the encoder network. Both features merged and then the rest of the network decides the images are the same or not. I have tried the following code:
I am receiving the following error:
ValueError: slice index 1 of dimension 2 out of bounds. for 'strided_slice' (op: 'StridedSlice') with input shapes: [?,1,1], [3], [3], [3] and with computed input tensors: input[1] = <0 0 1>, input[2] = <0 0 2>, input[3] = <1 1 1>
I am looking for a way to pass two images and plot the heatmaps on both images. Or even, if possible, modify the network architecture to process images one by one. I just want to visualize for a given image, where the network is focusing.
The text was updated successfully, but these errors were encountered: