class_docstr: Class that provides tracking of semantic segmentation as well as
  instance segmentation 
class_docstr_tok: ["Class","that","provides","tracking","of","semantic","segmentation","as","well","as","instance","segmentation"]
code: def _pred_instances_per_scan(
      clusters, predicted_labels, scores, batch, scan_id_offset
  ):
      # Get sample index offset
      ones = torch.ones_like(batch)
      sample_sizes = torch.cat(
          (torch.tensor([0]).to(batch.device), scatter_add(ones, batch))
      )
      offsets = sample_sizes.cumsum(dim=-1).cpu().numpy()
  
      # Build instance objects
      instances = []
      for i, cl in enumerate(clusters):
          sample_idx = batch[cl[0]].item()
          scan_id = sample_idx + scan_id_offset
          indices = cl.cpu().numpy() - offsets[sample_idx]
          instances.append(
              _Instance(
                  classname=predicted_labels[cl[0]].item(),
                  score=scores[i].item(),
                  indices=indices,
                  scan_id=scan_id,
              )
          )
      return instances
  
imports: import torchnet
  from typing import NamedTuple, Dict, Any, List, Tuple
  import torch
  import numpy
  from torch_scatter import scatter_add
  from collections import OrderedDict, defaultdict
  from torch_points3d.models.model_interface import TrackerInterface
  from torch_points3d.metrics.segmentation_tracker import SegmentationTracker
  from torch_points3d.metrics.base_tracker import BaseTracker, meter_value
  from torch_points3d.models.panoptic.structures import PanopticResults, PanopticLabels
  from torch_points_kernels import instance_iou
  from .box_detection.ap import voc_ap
label_desc: Use image node_id 7 for calling the PanopticTracker obj's underlying member method code with example usage: obj._pred_instances_per_scan(clusters, predicted_labels, scores, batch, scan_id_offset) and returns: instances