class_docstr: Implementation of `SparseInst <https://arxiv.org/abs/1912.02424>`_
  
  Args:
      data_preprocessor (:obj:`ConfigDict` or dict, optional): Config of
          :class:`DetDataPreprocessor` to process the input data.
          Defaults to None.
      backbone (:obj:`ConfigDict` or dict): The backbone module.
      encoder (:obj:`ConfigDict` or dict): The encoder module.
      decoder (:obj:`ConfigDict` or dict): The decoder module.
      criterion (:obj:`ConfigDict` or dict, optional): The training matcher
          and losses. Defaults to None.
      test_cfg (:obj:`ConfigDict` or dict, optional): The testing config
          of SparseInst. Defaults to None.
      init_cfg (:obj:`ConfigDict` or dict, optional): the config to control
          the initialization. Defaults to None.
class_docstr_tok: ["Implementation","of","`","SparseInst","<","https",":","\/\/arxiv.org\/abs\/1912.02424",">","`","_","Args",":","data_preprocessor","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","of",":","class",":","`","DetDataPreprocessor","`","to","process","the","input","data",".","Defaults","to","None",".","backbone","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","backbone","module",".","encoder","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","encoder","module",".","decoder","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","decoder","module",".","criterion","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","training","matcher","and","losses",".","Defaults","to","None",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","testing","config","of","SparseInst",".","Defaults","to","None",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","the","config","to","control","the","initialization",".","Defaults","to","None","."]
code: def __init__(
      self,
      data_preprocessor: ConfigType,
      backbone: ConfigType,
      encoder: ConfigType,
      decoder: ConfigType,
      criterion: OptConfigType = None,
      test_cfg: OptConfigType = None,
      init_cfg: OptConfigType = None,
  ):
      super().__init__(
          data_preprocessor=data_preprocessor, init_cfg=init_cfg
      )
  
      # backbone
      self.backbone = MODELS.build(backbone)
      # encoder & decoder
      self.encoder = MODELS.build(encoder)
      self.decoder = MODELS.build(decoder)
  
      # matcher & loss (matcher is built in loss)
      self.criterion = MODELS.build(criterion)
  
      # inference
      self.cls_threshold = test_cfg.score_thr
      self.mask_threshold = test_cfg.mask_thr_binary
  
file_path: mmdetection/projects/SparseInst/sparseinst/sparseinst.py
imports: from typing import List, Tuple, Union
  import torch
  import torch.nn.functional
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models import BaseDetector
  from mmdet.models.utils import unpack_gt_instances
  from mmdet.registry import MODELS
  from mmdet.structures import OptSampleList, SampleList
  from mmdet.utils import ConfigType, OptConfigType
label_desc: Use image node_id 1 to create a new SparseInst object from inherited base classes: BaseDetector with example: obj = SparseInst(data_preprocessor, backbone, encoder, decoder, criterion, test_cfg, init_cfg)