diff --git a/python-sdk/nuscenes/eval/panoptic/README.md b/python-sdk/nuscenes/eval/panoptic/README.md index ae8ee1f7..1c57c7e8 100644 --- a/python-sdk/nuscenes/eval/panoptic/README.md +++ b/python-sdk/nuscenes/eval/panoptic/README.md @@ -207,7 +207,7 @@ different segments. ### Multi-Object Panoptic Tracking #### Panoptic Tracking Quality (PTQ) -We use PTQ [Juana et al.](https://arxiv.org/pdf/2004.08189.pdf) that extends PQ with the IoU of matched segments with +We use PTQ [Hurtado et al.](https://arxiv.org/pdf/2004.08189.pdf) that extends PQ with the IoU of matched segments with track ID discrepancy, penalizing the incorrect track predictions. PTQ is defined as (∑{**1**(p,g) IoU(p,g)} - |IDS|) / (|TP|+ 0.5|FP|+ 0.5|FN|), where IDS stands for ID switches, and it is computed as the number of true positives (TP) that differ between tracking prediction and ground truth. diff --git a/python-sdk/nuscenes/panoptic/generate_panoptic_labels.py b/python-sdk/nuscenes/panoptic/generate_panoptic_labels.py index d8aad118..ba5ee5b6 100644 --- a/python-sdk/nuscenes/panoptic/generate_panoptic_labels.py +++ b/python-sdk/nuscenes/panoptic/generate_panoptic_labels.py @@ -15,6 +15,7 @@ from tqdm import tqdm from nuscenes.nuscenes import NuScenes +from nuscenes.panoptic.panoptic_utils import STUFF_START_CLASS_ID from nuscenes.utils.data_classes import LidarSegPointCloud from nuscenes.utils.geometry_utils import points_in_box @@ -70,7 +71,15 @@ def generate_panoptic_labels(nusc: NuScenes, out_dir: str, verbose: bool = False panop_labels[indices[index]] += instance_id overlap_box_count[indices[index]] += 1 - panop_labels[overlap_box_count > 1] = 0 + panop_labels[overlap_box_count > 1] = 0 # Set pixels overlapped by > 1 boxes to 0. + + # Thing pixels that are not inside any box have instance id == 0, reset them to 0. + # For these pixels that have thing semantic classes, but do not fall inside any annotation box, set their + # panoptic label to 0. + semantic_labels = panop_labels // 1000 + thing_mask = np.logical_and(semantic_labels > 0, semantic_labels < STUFF_START_CLASS_ID) + pixels_wo_box = np.logical_and(thing_mask, panop_labels % 1000 == 0) + panop_labels[pixels_wo_box] = 0 panoptic_file = nusc.get('lidarseg', lidar_token)['filename'].split('/')[-1] panoptic_file = panoptic_file.replace('lidarseg', 'panoptic')