The linked code should work.
However, the current layer (main[14]) only has one output pixel, so while the code will “visualize” this value, there might not be much information in this “image”.
I would suggest to select other layers with activation maps which are larger in their spatial size, so that you can visualize them accordingly.