Is there any way to look at the output of each layer of the Model and visualize it? #797
-
I want to look at the output of each layer of the Model and visualize it,I can do that with Torchvision like this:
What should I do with Timm?Thanks!@rwightman |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@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 |
Beta Was this translation helpful? Give feedback.
@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…