How to visualize detection pretrained models layer by layer?

the most appropriate soln I found was this one
Feature extraction for model inspection — Torchvision main documentation but i end up w/ this error

TraceError: Proxy object cannot be iterated. This can be attempted when the Proxy is used in a loop or as a *args or **kwargs function argument. See the torch.fx docs on for a more detailed explanation of what types of control flow can be traced, and check out the Proxy docstring for help troubleshooting Proxy iteration errors

My Code

from torchvision.models.feature_extraction import create_feature_extractor
from torchvision.models.detection import fasterrcnn_mobilenet_v3_large_320_fpn

m = fasterrcnn_mobilenet_v3_large_320_fpn()

return_nodes = {
    'layer1': 'layer1'

create_feature_extractor(m, return_nodes=return_nodes)
1 Like

Same problem here, did you ever find a solution?