def __init__(self, backbone: Union[(nn.Module, Mapping)], neck: Union[(nn.Module, Mapping, None)]=None, *, pretrained_backbone: Optional[str]=None, output_shapes: List[ShapeSpec], output_names: Optional[List[str]]=None):
    '\n        Args:\n            backbone: either a backbone module or a mmdet config dict that defines a\n                backbone. The backbone takes a 4D image tensor and returns a\n                sequence of tensors.\n            neck: either a backbone module or a mmdet config dict that defines a\n                neck. The neck takes outputs of backbone and returns a\n                sequence of tensors. If None, no neck is used.\n            pretrained_backbone: defines the backbone weights that can be loaded by\n                mmdet, such as "torchvision://resnet50".\n            output_shapes: shape for every output of the backbone (or neck, if given).\n                stride and channels are often needed.\n            output_names: names for every output of the backbone (or neck, if given).\n                By default, will use "out0", "out1", ...\n        '
    super().__init__()
    if isinstance(backbone, Mapping):
        from mmdet.models import build_backbone
        backbone = build_backbone(_to_container(backbone))
    self.backbone = backbone
    if isinstance(neck, Mapping):
        from mmdet.models import build_neck
        neck = build_neck(_to_container(neck))
    self.neck = neck
    logger.info(f'Initializing mmdet backbone weights: {pretrained_backbone} ...')
    self.backbone.init_weights(pretrained_backbone)
    self.backbone.train()
    if (self.neck is not None):
        logger.info('Initializing mmdet neck weights ...')
        if isinstance(self.neck, nn.Sequential):
            for m in self.neck:
                m.init_weights()
        else:
            self.neck.init_weights()
        self.neck.train()
    self._output_shapes = output_shapes
    if (not output_names):
        output_names = [f'out{i}' for i in range(len(output_shapes))]
    self._output_names = output_names
Args:
    backbone: either a backbone module or a mmdet config dict that defines a
        backbone. The backbone takes a 4D image tensor and returns a
        sequence of tensors.
    neck: either a backbone module or a mmdet config dict that defines a
        neck. The neck takes outputs of backbone and returns a
        sequence of tensors. If None, no neck is used.
    pretrained_backbone: defines the backbone weights that can be loaded by
        mmdet, such as "torchvision://resnet50".
    output_shapes: shape for every output of the backbone (or neck, if given).
        stride and channels are often needed.
    output_names: names for every output of the backbone (or neck, if given).
        By default, will use "out0", "out1", ...
def __init__(self, backbone: Union[(nn.Module, Mapping)], neck: Union[(nn.Module, Mapping, None)]=None, *, pretrained_backbone: Optional[str]=None, output_shapes: List[ShapeSpec], output_names: Optional[List[str]]=None):
    '\n        Args:\n            backbone: either a backbone module or a mmdet config dict that defines a\n                backbone. The backbone takes a 4D image tensor and returns a\n                sequence of tensors.\n            neck: either a backbone module or a mmdet config dict that defines a\n                neck. The neck takes outputs of backbone and returns a\n                sequence of tensors. If None, no neck is used.\n            pretrained_backbone: defines the backbone weights that can be loaded by\n                mmdet, such as "torchvision://resnet50".\n            output_shapes: shape for every output of the backbone (or neck, if given).\n                stride and channels are often needed.\n            output_names: names for every output of the backbone (or neck, if given).\n                By default, will use "out0", "out1", ...\n        '
    super().__init__()
    if isinstance(backbone, Mapping):
        from mmdet.models import build_backbone
        backbone = build_backbone(_to_container(backbone))
    self.backbone = backbone
    if isinstance(neck, Mapping):
        from mmdet.models import build_neck
        neck = build_neck(_to_container(neck))
    self.neck = neck
    logger.info(f'Initializing mmdet backbone weights: {pretrained_backbone} ...')
    self.backbone.init_weights(pretrained_backbone)
    self.backbone.train()
    if (self.neck is not None):
        logger.info('Initializing mmdet neck weights ...')
        if isinstance(self.neck, nn.Sequential):
            for m in self.neck:
                m.init_weights()
        else:
            self.neck.init_weights()
        self.neck.train()
    self._output_shapes = output_shapes
    if (not output_names):
        output_names = [f'out{i}' for i in range(len(output_shapes))]
    self._output_names = output_names