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)#

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:
Dict[int, Sequence[Polygon]]

Dictionary of polygons for each instance.