class_docstr: A instance embedding head described in :paper:`Panoptic-DeepLab`.
docstr: NOTE: this interface is experimental.
  
  Args:
      input_shape (ShapeSpec): shape of the input feature
      decoder_channels (list[int]): a list of output channels of each
          decoder stage. It should have the same length as "input_shape"
          (each element in "input_shape" corresponds to one decoder stage).
      norm (str or callable): normalization for all conv layers.
      head_channels (int): the output channels of extra convolutions
          between decoder and predictor.
      center_loss_weight (float): loss weight for center point prediction.
      offset_loss_weight (float): loss weight for center offset prediction.
docstr_tok: ["NOTE",":","this","interface","is","experimental",".","Args",":","input_shape","(","ShapeSpec",")",":","shape","of","the","input","feature","decoder_channels","(","list","[","int","]",")",":","a","list","of","output","channels","of","each","decoder","stage",".","It","should","have","the","same","length","as","``","input_shape","''","(","each","element","in","``","input_shape","''","corresponds","to","one","decoder","stage",")",".","norm","(","str","or","callable",")",":","normalization","for","all","conv","layers",".","head_channels","(","int",")",":","the","output","channels","of","extra","convolutions","between","decoder","and","predictor",".","center_loss_weight","(","float",")",":","loss","weight","for","center","point","prediction",".","offset_loss_weight","(","float",")",":","loss","weight","for","center","offset","prediction","."]
code: def __init__(
      self,
      input_shape: Dict[str, ShapeSpec],
      *,
      decoder_channels: List[int],
      norm: Union[str, Callable],
      head_channels: int,
      center_loss_weight: float,
      offset_loss_weight: float,
      **kwargs,
  ):
      """
      NOTE: this interface is experimental.
  
      Args:
          input_shape (ShapeSpec): shape of the input feature
          decoder_channels (list[int]): a list of output channels of each
              decoder stage. It should have the same length as "input_shape"
              (each element in "input_shape" corresponds to one decoder stage).
          norm (str or callable): normalization for all conv layers.
          head_channels (int): the output channels of extra convolutions
              between decoder and predictor.
          center_loss_weight (float): loss weight for center point prediction.
          offset_loss_weight (float): loss weight for center offset prediction.
      """
      super().__init__(
          input_shape,
          decoder_channels=decoder_channels,
          norm=norm,
          **kwargs,
      )
      assert self.decoder_only
  
      self.center_loss_weight = center_loss_weight
      self.offset_loss_weight = offset_loss_weight
      use_bias = norm == ""
      # center prediction
      # `head` is additional transform before predictor
      self.center_head = nn.Sequential(
          Conv2d(
              decoder_channels[0],
              decoder_channels[0],
              kernel_size=3,
              padding=1,
              bias=use_bias,
              norm=get_norm(norm, decoder_channels[0]),
              activation=F.relu,
          ),
          Conv2d(
              decoder_channels[0],
              head_channels,
              kernel_size=3,
              padding=1,
              bias=use_bias,
              norm=get_norm(norm, head_channels),
              activation=F.relu,
          ),
      )
      weight_init.c2_xavier_fill(self.center_head[0])
      weight_init.c2_xavier_fill(self.center_head[1])
      self.center_predictor = Conv2d(head_channels, 1, kernel_size=1)
      nn.init.normal_(self.center_predictor.weight, 0, 0.001)
      nn.init.constant_(self.center_predictor.bias, 0)
  
      # offset prediction
      # `head` is additional transform before predictor
      if self.use_depthwise_separable_conv:
          # We use a single 5x5 DepthwiseSeparableConv2d to replace
          # 2 3x3 Conv2d since they have the same receptive field.
          self.offset_head = DepthwiseSeparableConv2d(
              decoder_channels[0],
              head_channels,
              kernel_size=5,
              padding=2,
              norm1=norm,
              activation1=F.relu,
              norm2=norm,
              activation2=F.relu,
          )
      else:
          self.offset_head = nn.Sequential(
              Conv2d(
                  decoder_channels[0],
                  decoder_channels[0],
                  kernel_size=3,
                  padding=1,
                  bias=use_bias,
                  norm=get_norm(norm, decoder_channels[0]),
                  activation=F.relu,
              ),
              Conv2d(
                  decoder_channels[0],
                  head_channels,
                  kernel_size=3,
                  padding=1,
                  bias=use_bias,
                  norm=get_norm(norm, head_channels),
                  activation=F.relu,
              ),
          )
          weight_init.c2_xavier_fill(self.offset_head[0])
          weight_init.c2_xavier_fill(self.offset_head[1])
      self.offset_predictor = Conv2d(head_channels, 2, kernel_size=1)
      nn.init.normal_(self.offset_predictor.weight, 0, 0.001)
      nn.init.constant_(self.offset_predictor.bias, 0)
  
      self.center_loss = nn.MSELoss(reduction="none")
      self.offset_loss = nn.L1Loss(reduction="none")
  
imports: import numpy
  from typing import Callable, Dict, List, Union
  import fvcore.nn.weight_init
  import torch
  from torch import nn
  from torch.nn import functional
  from detectron2.config import configurable
  from detectron2.data import MetadataCatalog
  from detectron2.layers import Conv2d, DepthwiseSeparableConv2d, ShapeSpec, get_norm
  from detectron2.modeling import META_ARCH_REGISTRY, SEM_SEG_HEADS_REGISTRY, build_backbone, build_sem_seg_head
  from detectron2.modeling.postprocessing import sem_seg_postprocess
  from detectron2.projects.deeplab import DeepLabV3PlusHead
  from detectron2.projects.deeplab.loss import DeepLabCE
  from detectron2.structures import BitMasks, ImageList, Instances
  from detectron2.utils.registry import Registry
  from .post_processing import get_panoptic_segmentation
label_desc: Use image node_id 1 to create a new PanopticDeepLabInsEmbedHead object from inherited base classes: DeepLabV3PlusHead with example: obj = PanopticDeepLabInsEmbedHead(input_shape)