class_docstr: This class defines the `SSD object detection Head <https://arxiv.org/abs/1512.02325>`_
  
  Args:
      opts: command-line arguments
      in_channels (int): :math:`C` from an expected input of size :math:`(N, C, H, W)`
      n_anchors (int): Number of anchors
      n_classes (int): Number of classes in the dataset
      n_coordinates (Optional[int]): Number of coordinates. Default: 4 (x, y, w, h)
      proj_channels (Optional[int]): Number of projected channels. If `-1`, then projection layer is not used
      kernel_size (Optional[int]): Kernel size in convolutional layer. If kernel_size=1, then standard
          point-wise convolution is used. Otherwise, separable convolution is used
      stride (Optional[int]): stride for feature map. If stride > 1, then feature map is sampled at this rate
          and predictions are made on fewer pixels as compared to the input tensor. Default: 1
class_docstr_tok: ["This","class","defines","the","`","SSD","object","detection","Head","<","https",":","\/\/arxiv.org\/abs\/1512.02325",">","`","_","Args",":","opts",":","command-line","arguments","in_channels","(","int",")",":",":","math",":","`","C","`","from","an","expected","input","of","size",":","math",":","`","(","N",",","C",",","H",",","W",")","`","n_anchors","(","int",")",":","Number","of","anchors","n_classes","(","int",")",":","Number","of","classes","in","the","dataset","n_coordinates","(","Optional","[","int","]",")",":","Number","of","coordinates",".","Default",":","4","(","x",",","y",",","w",",","h",")","proj_channels","(","Optional","[","int","]",")",":","Number","of","projected","channels",".","If","`","-1","`",",","then","projection","layer","is","not","used","kernel_size","(","Optional","[","int","]",")",":","Kernel","size","in","convolutional","layer",".","If","kernel_size=1",",","then","standard","point-wise","convolution","is","used",".","Otherwise",",","separable","convolution","is","used","stride","(","Optional","[","int","]",")",":","stride","for","feature","map",".","If","stride",">","1",",","then","feature","map","is","sampled","at","this","rate","and","predictions","are","made","on","fewer","pixels","as","compared","to","the","input","tensor",".","Default",":","1"]
code: def __init__(
      self,
      opts,
      in_channels: int,
      n_anchors: int,
      n_classes: int,
      n_coordinates: Optional[int] = 4,
      proj_channels: Optional[int] = -1,
      kernel_size: Optional[int] = 3,
      stride: Optional[int] = 1,
      *args,
      **kwargs,
  ) -> None:
      super().__init__()
      proj_layer = None
      self.proj_channels = None
      if (
          proj_channels != -1
          and proj_channels != in_channels
          and kernel_size > 1
      ):
          proj_layer = ConvLayer2d(
              opts=opts,
              in_channels=in_channels,
              out_channels=proj_channels,
              kernel_size=1,
              stride=1,
              groups=1,
              bias=False,
              use_norm=True,
              use_act=True,
          )
          in_channels = proj_channels
          self.proj_channels = proj_channels
  
      self.proj_layer = proj_layer
  
      conv_fn = ConvLayer2d if kernel_size == 1 else SeparableConv2d
      if kernel_size > 1 and stride > 1:
          kernel_size = max(
              kernel_size, stride if stride % 2 != 0 else stride + 1
          )
      self.loc_cls_layer = conv_fn(
          opts=opts,
          in_channels=in_channels,
          out_channels=n_anchors * (n_coordinates + n_classes),
          kernel_size=kernel_size,
          stride=1,
          groups=1,
          bias=True,
          use_norm=False,
          use_act=False,
      )
  
      self.n_coordinates = n_coordinates
      self.n_classes = n_classes
      self.n_anchors = n_anchors
      self.k_size = kernel_size
      self.stride = stride
      self.in_channel = in_channels
  
      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 SSDHead object from inherited base classes: BaseModule with example: obj = SSDHead(opts, in_channels, n_anchors, n_classes, n_coordinates, proj_channels, kernel_size, stride)