class_docstr: Simple convolutional head, using group norm.
  Upsampling is done using a FPN approach
class_docstr_tok: ["Simple","convolutional","head",",","using","group","norm",".","Upsampling","is","done","using","a","FPN","approach"]
code: def __init__(self, dim, fpn_dims, context_dim):
      super().__init__()
  
      inter_dims = [
          dim,
          context_dim // 2,
          context_dim // 4,
          context_dim // 8,
          context_dim // 16,
          context_dim // 64,
      ]
      self.lay1 = torch.nn.Conv2d(dim, dim, 3, padding=1)
      self.gn1 = torch.nn.GroupNorm(8, dim)
      self.lay2 = torch.nn.Conv2d(dim, inter_dims[1], 3, padding=1)
      self.gn2 = torch.nn.GroupNorm(8, inter_dims[1])
      self.lay3 = torch.nn.Conv2d(
          inter_dims[1], inter_dims[2], 3, padding=1
      )
      self.gn3 = torch.nn.GroupNorm(8, inter_dims[2])
      self.lay4 = torch.nn.Conv2d(
          inter_dims[2], inter_dims[3], 3, padding=1
      )
      self.gn4 = torch.nn.GroupNorm(8, inter_dims[3])
      self.lay5 = torch.nn.Conv2d(
          inter_dims[3], inter_dims[4], 3, padding=1
      )
      self.gn5 = torch.nn.GroupNorm(8, inter_dims[4])
      self.out_lay = torch.nn.Conv2d(inter_dims[4], 1, 3, padding=1)
  
      self.dim = dim
  
      self.adapter1 = torch.nn.Conv2d(fpn_dims[0], inter_dims[1], 1)
      self.adapter2 = torch.nn.Conv2d(fpn_dims[1], inter_dims[2], 1)
      self.adapter3 = torch.nn.Conv2d(fpn_dims[2], inter_dims[3], 1)
  
      for m in self.modules():
          if isinstance(m, nn.Conv2d):
              nn.init.kaiming_uniform_(m.weight, a=1)
              nn.init.constant_(m.bias, 0)
  
imports: import io
  from collections import defaultdict
  from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from PIL import Image
  import util.box_ops
  from util.misc import NestedTensor, interpolate, nested_tensor_from_tensor_list
label_desc: Use image node_id 1 to create a new MaskHeadSmallConv object from inherited base classes: nn with example: obj = MaskHeadSmallConv(dim, fpn_dims, context_dim)