class_docstr: Base class of Two-stage Panoptic Segmentor.
  
  As well as the components in TwoStageDetector, Panoptic Segmentor has extra
  semantic_head and panoptic_fusion_head.
class_docstr_tok: ["Base","class","of","Two-stage","Panoptic","Segmentor",".","As","well","as","the","components","in","TwoStageDetector",",","Panoptic","Segmentor","has","extra","semantic_head","and","panoptic_fusion_head","."]
docstr: Add predictions to `DetDataSample`.
  
  Args:
      data_samples (list[:obj:`DetDataSample`]): The
          annotation data of every samples.
      results_list (List[PixelData]): Panoptic segmentation results of
          each image.
  
  Returns:
      List[:obj:`DetDataSample`]: Return the packed panoptic segmentation
          results of input images. Each DetDataSample usually contains
          'pred_panoptic_seg'. And the 'pred_panoptic_seg' has a key
          ``sem_seg``, which is a tensor of shape (1, h, w).
docstr_tok: ["Add","predictions","to","`","DetDataSample","`",".","Args",":","data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","The","annotation","data","of","every","samples",".","results_list","(","List","[","PixelData","]",")",":","Panoptic","segmentation","results","of","each","image",".","Returns",":","List","[",":","obj",":","`","DetDataSample","`","]",":","Return","the","packed","panoptic","segmentation","results","of","input","images",".","Each","DetDataSample","usually","contains","'pred_panoptic_seg","'",".","And","the","'pred_panoptic_seg","'","has","a","key","``","sem_seg","``",",","which","is","a","tensor","of","shape","(","1",",","h",",","w",")","."]
code: def add_pred_to_datasample(
      self, data_samples: SampleList, results_list: List[PixelData]
  ) -> SampleList:
      """Add predictions to `DetDataSample`.
  
      Args:
          data_samples (list[:obj:`DetDataSample`]): The
              annotation data of every samples.
          results_list (List[PixelData]): Panoptic segmentation results of
              each image.
  
      Returns:
          List[:obj:`DetDataSample`]: Return the packed panoptic segmentation
              results of input images. Each DetDataSample usually contains
              'pred_panoptic_seg'. And the 'pred_panoptic_seg' has a key
              ``sem_seg``, which is a tensor of shape (1, h, w).
      """
  
      for data_sample, pred_panoptic_seg in zip(
          data_samples, results_list
      ):
          data_sample.pred_panoptic_seg = pred_panoptic_seg
      return data_samples
  
file_path: mmdetection/mmdet/models/detectors/panoptic_two_stage_segmentor.py
imports: import copy
  from typing import List
  import torch
  from mmengine.structures import PixelData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .two_stage import TwoStageDetector
label_desc: Use image node_id 7 for calling the TwoStagePanopticSegmentor obj's underlying member method code with example usage: obj.add_pred_to_datasample(data_samples, results_list) and returns: data_samples