class_docstr: Instance segmentation head for SSD model.
class_docstr_tok: ["Instance","segmentation","head","for","SSD","model","."]
docstr: Args:
      opts: command-line arguments
      in_channels (int): :math:`C` from an expected input of size :math:`(N, C, H, W)`
      n_classes (Optional[int]): Number of classes. Default: 1
      inner_dim: (Optional[int]): Inner dimension of the instance head. Default: 256
      output_stride (Optional[int]): Output stride of the feature map. Output stride is the ratio of input to
          the feature map size. Default: 1
      output_size (Optional[int]): Output size of the instances extracted from RoIAlign layer. Default: 8
docstr_tok: ["Args",":","opts",":","command-line","arguments","in_channels","(","int",")",":",":","math",":","`","C","`","from","an","expected","input","of","size",":","math",":","`","(","N",",","C",",","H",",","W",")","`","n_classes","(","Optional","[","int","]",")",":","Number","of","classes",".","Default",":","1","inner_dim",":","(","Optional","[","int","]",")",":","Inner","dimension","of","the","instance","head",".","Default",":","256","output_stride","(","Optional","[","int","]",")",":","Output","stride","of","the","feature","map",".","Output","stride","is","the","ratio","of","input","to","the","feature","map","size",".","Default",":","1","output_size","(","Optional","[","int","]",")",":","Output","size","of","the","instances","extracted","from","RoIAlign","layer",".","Default",":","8"]
code: def __init__(
      self,
      opts,
      in_channels: int,
      n_classes: Optional[int] = 1,
      inner_dim: Optional[int] = 256,
      output_stride: Optional[int] = 1,
      output_size: Optional[int] = 8,
      *args,
      **kwargs,
  ) -> None:
      """
  
      Args:
          opts: command-line arguments
          in_channels (int): :math:`C` from an expected input of size :math:`(N, C, H, W)`
          n_classes (Optional[int]): Number of classes. Default: 1
          inner_dim: (Optional[int]): Inner dimension of the instance head. Default: 256
          output_stride (Optional[int]): Output stride of the feature map. Output stride is the ratio of input to
              the feature map size. Default: 1
          output_size (Optional[int]): Output size of the instances extracted from RoIAlign layer. Default: 8
      """
      super().__init__()
      self.roi_align = RoIAlign(
          output_size=output_size,
          spatial_scale=1.0 / output_stride,
          sampling_ratio=2,
          aligned=True,
      )
  
      self.seg_head = nn.Sequential(
          TransposeConvLayer2d(
              opts=opts,
              in_channels=in_channels,
              out_channels=inner_dim,
              kernel_size=2,
              stride=2,
              bias=True,
              use_norm=False,
              use_act=True,
              auto_padding=False,
              padding=0,
              output_padding=0,
          ),
          ConvLayer2d(
              opts=opts,
              in_channels=inner_dim,
              out_channels=n_classes,
              kernel_size=1,
              stride=1,
              use_norm=False,
              use_act=False,
              bias=True,
          ),
      )
      self.inner_channels = inner_dim
      self.in_channels = in_channels
      self.mask_classes = n_classes
      self.reset_parameters()
  
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor, nn
  from torchvision.ops.roi_align import RoIAlign
  from cvnets.layers import ConvLayer2d, SeparableConv2d, TransposeConvLayer2d
  from cvnets.misc.init_utils import initialize_conv_layer
  from cvnets.modules import BaseModule
label_desc: Use image node_id 1 to create a new SSDInstanceHead object from inherited base classes: BaseModule with example: obj = SSDInstanceHead(opts, in_channels, n_classes, inner_dim, output_stride, output_size)