Visualizing intermediate layers a la Zeiler and Fergus

Dear @dhoa,

I now created a notebook with single image prediction and activation visualization based on your code from your post: https://github.com/MicPie/fastai_course_v3/blob/master/L1-stonefly_activations_v2.ipynb

With the flatten_model function it is easy to get the layers of interest and the hook gets installed by calling hook_outputs(layers).

Where did you find the flatten_model and the other parts of the code snippet so I can dive a little deeper into this topic?
I guess the callback is not needed for getting the activations and is for more advanced operations or am I wrong?
If somebody has more information/sample code/etc. on this topic I would be very interested. :smiley:

Regards
Michael

6 Likes