@@ -149,28 +149,31 @@ def rotated_rects(self, value):
149149
150150
151151class Contour :
152- """Represents a contour object with label, probability, shape, and optional excluded shapes .
152+ """Represents a semantic segmentation mask as internals of a contour with "holes" .
153153 Args:
154154 label (str): The label of the contour.
155155 probability (float): The probability associated with the contour.
156- shape (np.ndarray | list[tuple[int, int]]): The shape of the contour.
157- child_shapes (list[np.ndarray] | list[tuple[int, int]] | None, optional): Shapes of excluded contours. Defaults to None.
156+ shape (np.ndarray | list[tuple[int, int]]): The shape of the contour. Shape is represented as a
157+ list of 2d points or an equivalent numpy array (N, 2).
158+ excluded_shapes (list[np.ndarray] | list[tuple[int, int]] | None, optional): Shapes of excluded contours.
159+ If empty, the main shape is simply connected. Otherwise, excluded_shapes
160+ represent "holes". Defaults to None.
158161 """
159162
160163 def __init__ (
161164 self ,
162165 label : str ,
163166 probability : float ,
164167 shape : np .ndarray | list [tuple [int , int ]],
165- child_shapes : list [np .ndarray ] | list [tuple [int , int ]] | None = None ,
168+ excluded_shapes : list [np .ndarray ] | list [tuple [int , int ]] | None = None ,
166169 ):
167170 self .shape = shape
168171 self .label = label
169172 self .probability = probability
170- self .child_shapes = child_shapes
173+ self .excluded_shapes = excluded_shapes
171174
172175 def __str__ (self ):
173- num_children = len (self .child_shapes ) if self .child_shapes is not None else 0
176+ num_children = len (self .excluded_shapes ) if self .excluded_shapes is not None else 0
174177 return f"{ self .label } : { self .probability :.3f} , { len (self .shape )} , { num_children } "
175178
176179 def __repr__ (self ):
0 commit comments