Skip to content

Is there any way to look at the output of each layer of the Model and visualize it? #797

Answered by rwightman
Lookforworld asked this question in Q&A
Discussion options

You must be logged in to vote

@Lookforworld same thing works for timm models, you just need some familiarity with each model family so you know which module names to hook. There is a much greater diversity of models in timm so it's a bit more work.

There is a utility in https://github.com/rwightman/pytorch-image-models/blob/master/timm/utils/model.py#L35 that might make it a bit easier, it was built for extracting activation stats, but you could use it for grabbing/stashing the activations as well. In addition to being able to specify each module name to hook, you can also use wildcards to grab a bunch with similar names.

You can avoid using hooks and use features_only=True mode if you happen to only want the activati…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Lookforworld
Comment options

Answer selected by Lookforworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants