lazyslide.cv.InstanceMap

lazyslide.cv.InstanceMap#

class InstanceMap(instance_map, prob_map=None, class_names=None)#

Bases: Mask

The class for instance mask.

to_polygons(min_area=0, min_hole_area=0, detect_holes=True, ignore_index=None, region_filter=None)#

Convert instance mask to polygons.

Parameters:
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:
geopandas.GeoDataFrame

One row per instance, with its polygon in geometry and source label in instance_id. Probability and class columns are included when a probability map is available.