heuritech / convnets-keras

MIT License
594 stars 185 forks source link

vgg networks dont't produce heatmaps #40

Open kirk86 opened 7 years ago

kirk86 commented 7 years ago

Hi I've tried your code but the vgg networks don't actually produce heatmaps. Only alexnet does. Even with the flag heatmap=True the shape of the out from model.predict() on vgg networks is (1,1000, 1, 1) for the dog example that you have provided.

ZFTurbo commented 7 years ago

I think the problem is with border mode. It must be: border_mode='same'

model.add(Convolution2D(4096, 7, 7, border_mode='same', activation="relu", name="dense_1"))
model.add(Convolution2D(4096, 1, 1, border_mode='same', activation="relu", name="dense_2"))
model.add(Convolution2D(classes_number, 1, 1, name="dense_3"))
model.add(Softmax4D(axis=1, name="softmax"))

At least it fix the shape of output. I didn't check the real heatmap images.