@ptrblck: I am still doing experiments on these, but today, I saw this snippet with detectron2:
https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html 2
these lines:

# load a pre-trained model for classification and return
# only the features
backbone = torchvision.models.mobilenet_v2(pretrained=True).features
# FasterRCNN needs to know the number of
# output channels in a backbone. For mobilenet_v2, it's 1280
# so we need to add it here
backbone.out_channels = 1280

means that instead of using Identity() as you suggested, they are using just the .features  but, I am perplexed how they are assigning the out_channels here as 1280, since the features as you have shown on this line:

  
      github.com
  
  
    pytorch/vision/blob/650e3dbe2ca36f818b3fb121af774b01fa18d466/torchvision/models/mobilenet.py#L166 2

                nn.init.zeros_(m.bias)
            elif isinstance(m, nn.Linear):
                nn.init.normal_(m.weight, 0, 0.01)
                nn.init.zeros_(m.bias)

    def _forward_impl(self, x):
        # This exists since TorchScript doesn't support inheritance, so the superclass method
        # (this one) needs to have a name other than `forward` that can be accessed in a subclass
        x = self.features(x)
        # Cannot use "squeeze" as batch-size can be 1 => must use reshape with x.shape[0]
        x = nn.functional.adaptive_avg_pool2d(x, 1).reshape(x.shape[0], -1)
        x = self.classifier(x)
        return x

    def forward(self, x):
        return self._forward_impl(x)


def mobilenet_v2(pretrained=False, progress=True, **kwargs):
    """
    Constructs a MobileNetV2 architecture from



  
  
    
    
  
  


…uses avg pooling to get to 1280. So, what is the detectron tutorial doing here?  Using just the features cannot result in a vector of size 1280. Would be nice to know what this tutorial is doing