code: def _get_panoptic_segmentation(
      self, sem_seg, center_heatmap, offsets, foreground_mask=None
  ):
      if foreground_mask is not None:
          thing_seg = foreground_mask
      else:
          # Inference from semantic segmentation
          thing_seg = paddle.zeros_like(sem_seg).astype("bool")
          for thing_class in list(self.thing_ids):
              thing_seg |= sem_seg == thing_class
          thing_seg = paddle.cast(thing_seg, paddle.int64)
  
      instance, center = self._get_instance_segmentation(
          sem_seg, center_heatmap, offsets, thing_seg
      )
      panoptic = self._merge_semantic_and_instance(
          sem_seg, instance, thing_seg
      )
  
      return panoptic
  
file_path: PaddleSeg/contrib/PanopticSeg/paddlepanseg/postprocessors/panoptic_deeplab_pp.py
imports: from collections import Counter
  import paddle
  import paddle.nn.functional
  from paddlepanseg.cvlibs import build_info_dict, manager
  from paddlepanseg.utils import encode_pan_id
  from paddlepanseg.postprocessors.base_pp import Postprocessor
label_desc: Use image node_id 7 for calling the PanopticDeepLabPostprocessor obj's underlying member method code with example usage: obj._get_panoptic_segmentation(sem_seg, center_heatmap, offsets, foreground_mask) and returns: panoptic