lazyslide.cv.ProbabilityMap

lazyslide.cv.ProbabilityMap#

class ProbabilityMap(probability_map, prob_map=None, class_names=None)#

Bases: Mask

A 2D (H, W) or 3D (C, H, W) map of probabilities in [0, 1].

Parameters:
probability_mapnp.ndarray

The floating point probability map.

prob_mapnp.ndarray, optional

Deprecated since version 0.13.0: Has no effect and will be removed in 0.14.0; the probability map is its own probability.

class_namessequence of str or mapping of int to str, optional

The class names, one per channel of a 3D map.

to_polygons(threshold=0.5, min_area=0, min_hole_area=0, detect_holes=True, ignore_index=0)#

Convert the probability map to polygons.

Parameters:
thresholdfloat

Threshold to convert the probability map to term:binary mask.

min_areafloat

Minimum area of detected regions to be included in the polygon`.

min_hole_areafloat

Minimum area of detected holes to be included in the polygon`.

detect_holesbool

Whether to detect holes in regions.

ignore_indexint or Sequence[int] or None

Indexes to ignore.

Returns:
gpd.GeoDataFrame

GeoDataFrame containing polygons and their probabilities.