lazyslide.cv.nms

Contents

lazyslide.cv.nms#

nms(gdf, prob_col, iou_threshold=0.2, buffer_px=0)#

Performs non-maximum suppression (NMS) on a GeoDataFrame containing polygon geometries.

This function is primarily used to reduce overlapping polygons by selecting only the most probable geometric shapes according to the specified probability column. NMS process is guided by the intersection over union (IoU) threshold, buffering distance, and probability values associated with polygons.

Parameters:
gdfgpd.GeoDataFrame

A GeoDataFrame containing geometric data for processing.

prob_colstr

Column name containing the probability values that determine the importance of each polygon.

iou_thresholdfloat

A threshold value that defines the minimum IoU for polygons to be considered for suppression. Default is 0.2.

buffer_pxfloat

Buffer distance for polygons before performing non-maximum suppression. Default is 0.

Returns:
gpd.GeoDataFrame

A new GeoDataFrame containing only the selected polygons after applying non-maximum suppression.