lazyslide.metrics.segmentation.get_semantic_stats

lazyslide.metrics.segmentation.get_semantic_stats#

get_semantic_stats(gdf_true, gdf_pred)#

Compute semantic segmentation statistics using area-based overlap.

This function evaluates semantic segmentation performance by computing area-based statistics between ground truth and predicted polygons. It calculates intersection areas to determine true positives, false positives, and false negatives based on geometric overlap.

Parameters:
gdf_truegpd.GeoDataFrame

Ground truth semantic segmentation as a GeoDataFrame with geometry column containing polygon geometries representing true regions.

gdf_predgpd.GeoDataFrame

Predicted semantic segmentation as a GeoDataFrame with geometry column containing polygon geometries representing predicted regions.

Returns:
SegmentationStats

Statistics object containing: - tp: True positive area (intersection between ground truth and predictions) - fp: False positive area (predicted area not overlapping with ground truth) - fn: False negative area (ground truth area not covered by predictions) - tn: Always 0 (background true negatives not well-defined for polygons) - ious: Always None (not applicable for semantic segmentation)