Hi, thank you for those networks, they're already really useful.
But I have a minor problem. While running the example with the dog, I noticed the heatmap has a very low resolution (43x73). This is the case also with other images (the resultion differ but is still very low) and I tried with the vgg16 and I have the same issue.
But the heatmap works and finds the dog.
Here is the the code i'm using:
if __name__ == "__main__":
### Here is a script to compute the heatmap of the dog synsets.
## We find the synsets corresponding to dogs on ImageNet website
s = "n02084071"
ids = synset_to_dfs_ids(s)
# Most of the synsets are not in the subset of the synsets used in ImageNet recognition task.
ids = np.array([id_ for id_ in ids if id_ is not None])
im = preprocess_image_batch(['examples/dog.jpg'], color_mode="rgb")
# Test pretrained model
sgd = SGD(lr=0.1, decay=1e-6, momentum=0.9, nesterov=True)
model = convnet('alexnet',weights_path="weights/alexnet_weights.h5", heatmap=True)
model.compile(optimizer=sgd, loss='mse')
out = model.predict(im)
heatmap = out[0,ids,:,:].sum(axis=0)
print(np.shape(heatmap))
import matplotlib.pyplot as plt
plt.imsave("heatmap_dog.png",heatmap)
Hi, thank you for those networks, they're already really useful.
But I have a minor problem. While running the example with the dog, I noticed the heatmap has a very low resolution (43x73). This is the case also with other images (the resultion differ but is still very low) and I tried with the vgg16 and I have the same issue.
But the heatmap works and finds the dog.
Here is the the code i'm using:
the result:
Thank you very much for your help.