mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

available output_layer_names in demo

Open iulsko opened this issue 2 years ago • 1 comments
trafficstars

How can I find out which layers are available for any network to define here - https://github.com/open-mmlab/mmpose/blob/1f11d6ccbaa034e50847feb92bc7cf7760a2e387/demo/top_down_video_demo_with_mmdet.py#L138 ?

i would specifically like to log the bottleneck, which is not available for a ResNet for some reason?

iulsko avatar Jan 05 '23 17:01 iulsko

Hi, thank you for using MMPose.

To print the structure of the pose model and find the name of a specific layer, you can use the print function. For example, if you want to see the structure of the model's backbone (e.g. ResNet50), you can use print(pose_model.backbone). This will output the model's structure, including all of its layers and their names:

ResNet(
  (conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
  (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (relu): ReLU(inplace=True)
  (maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
  (layer1): ResLayer(
    (0): Bottleneck(
      (conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
      (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (relu): ReLU(inplace=True)
      (downsample): Sequential(
        (0): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
    )
    ...

If you want to get the output of the first bottleneck in layer1, you can set output_layer_names to be ('backbone.layer1.0', ).

Ben-Louis avatar Jan 06 '23 03:01 Ben-Louis