lazyslide.metrics.segmentation.pq

Contents

lazyslide.metrics.segmentation.pq#

pq(stats)#

Compute Panoptic Quality (PQ) from segmentation statistics.

Panoptic Quality is a unified metric for evaluating panoptic segmentation that combines both detection quality (matching instances) and segmentation quality (IoU of matched instances). It balances both recognition and segmentation quality in a single metric.

Parameters:
statsSegmentationStats

Segmentation statistics containing IoU values for matched instances, true positives (tp), false positives (fp), and false negatives (fn). The ious field must not be None for meaningful PQ computation.

Returns:
float

Panoptic Quality score in the range [0, 1], where 1 indicates perfect panoptic segmentation quality. Returns 0.0 if no IoU values are available or if there are no true positive matches.

Notes

PQ = (sum of IoUs for matched pairs) / (TP + 0.5 * FP + 0.5 * FN)

The denominator weights unmatched instances (FP and FN) at half the weight of matched instances (TP) to balance detection and segmentation quality.