code: def __init__(
      self,
      opts: argparse.Namespace,
      encoder: BaseImageEncoder,
      output_strides: List,
      projection_channels: int,
      encoder_lr_multiplier: Optional[float] = 1.0,
      *args,
      **kwargs,
  ) -> None:
      use_fpn = not getattr(
          opts, "model.detection.mask_rcnn.disable_fpn", False
      )
      super().__init__()
      # set classifier and exp layers to Identity
      encoder.conv_1x1_exp = Identity()
      encoder.classifier = Identity()
  
      # add projection layers that projects encoder feature maps to `projection_channels`
      backbone_proj_layers = nn.ModuleDict()
      self.backbone_output_strides = sorted(
          list({4, 8, 16, 32}.intersection(output_strides))
      )
      model_config = encoder.model_conf_dict
      self.backbone_map = {}
      fpn_proj_layers = nn.ModuleDict() if use_fpn else None
      for os in self.backbone_output_strides:
          if os == 4:
              in_channels = model_config["layer2"]["out"]
              backbone_os_str = "out_l2"
          elif os == 8:
              in_channels = model_config["layer3"]["out"]
              backbone_os_str = "out_l3"
          elif os == 16:
              in_channels = model_config["layer4"]["out"]
              backbone_os_str = "out_l4"
          elif os == 32:
              in_channels = model_config["layer5"]["out"]
              backbone_os_str = "out_l5"
          else:
              raise NotImplementedError
  
          conv_layer = ConvLayer2d(
              opts=opts,
              in_channels=in_channels,
              out_channels=projection_channels,
              kernel_size=1,
              use_norm=True,
              use_act=False,
          )
          backbone_proj_layers.add_module(str(os), conv_layer)
          self.backbone_map[os] = backbone_os_str
  
          if use_fpn:
              fpn_layer = ConvLayer2d(
                  opts=opts,
                  in_channels=projection_channels,
                  out_channels=projection_channels,
                  kernel_size=3,
                  use_norm=True,
                  use_act=False,
              )
              fpn_proj_layers.add_module(str(os), fpn_layer)
  
      # add extra layers if desired output stride is greater than 32.
      extra_layers = nn.ModuleDict()
      extra_layer_os = sorted(
          list(
              (set(self.backbone_output_strides) ^ set(output_strides))
          )
      )
      for os in extra_layer_os:
          conv_layer = ConvLayer2d(
              opts=opts,
              in_channels=projection_channels,
              out_channels=projection_channels,
              kernel_size=3,
              stride=2,
              use_norm=True,
              use_act=False,
          )
          extra_layers.add_module(str(os), conv_layer)
      self.encoder = encoder
      self.backbone_proj_layers = backbone_proj_layers
      self.fpn_proj_layers = fpn_proj_layers
      self.use_fpn = use_fpn
      self.extra_layers = extra_layers
      self.out_channels = projection_channels
      self.augmented_tensor = None
      self.encoder_lr_multiplier = encoder_lr_multiplier
  
imports: import argparse
  from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  from torch import Tensor, nn
  from torch.nn import functional
  from torchvision.models.detection.anchor_utils import AnchorGenerator
  from torchvision.models.detection.mask_rcnn import MaskRCNN
  from torchvision.ops import MultiScaleRoIAlign
  from cvnets import parameter_list
  from cvnets.layers import ConvLayer2d, Identity
  from cvnets.models import MODEL_REGISTRY
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.detection import DetectionPredTuple
  from cvnets.models.detection.base_detection import BaseDetection
  from cvnets.models.detection.utils.rcnn_utils import FastRCNNConvFCHead, FastRCNNPredictor, MaskRCNNHeads, MaskRCNNPredictor, RPNHead
  from utils import logger
label_desc: Use image node_id 1 to create a new MaskRCNNEncoder object from inherited base classes: nn with example: obj = MaskRCNNEncoder(opts, encoder, output_strides, projection_channels, encoder_lr_multiplier)