API¶
This part of the documentation covers all the interfaces of Image Segmantic.
Annotation Object¶
-
class
imantics.
Annotation
(image, category, bbox=None, mask=None, polygons=None, id=0, color=None, metadata={})[source]¶ Annotation is a marking on an image.
This class acts as a level ontop of
BBox
,Mask
andPolygons
to manage and generate other annotations or export formats.-
area
¶ Qantity that expresses the extent of a two-dimensional figure
-
array
¶ Numpy array boolean mask repsentation of the annotations
-
export
(style='coco')¶ Exports object into specified style
-
classmethod
from_bbox
(image, category, bbox)[source]¶ Creates annotation from bounding box
Parameters:
-
classmethod
from_mask
(image, category, mask)[source]¶ Creates annotation class from a mask
Parameters:
-
classmethod
from_polygons
(image, category, polygons)[source]¶ Creates annotation from polygons
Accepts following format for lists:
# Segmentation Format [ [x1, y1, x2, y2, x3, y3,...], [x1, y1, x2, y2, x3, y3,...], ... ]
or
# Point Format [ [[x1, y1], [x2, y2], [x3, y3],...], [[x1, y1], [x2, y2], [x3, y3],...], ... ]
No sepcificaiton is reqiured between which format is used
Parameters:
-
size
¶ Tuple of width and height
-
Category Object¶
Bounding Box Object¶
Dataset Object¶
Image Object¶
-
class
imantics.
Image
(image_array, annotations=[], path='', id=0, metadata={})[source]¶ -
add
(annotation, category=None)[source]¶ Adds a annotaiton, list of annotaitons, mask, polygon or bbox to current image. If annotation is not a Annotation a category is required List of non-Annotaiton objects will have the same category
Parameters: - annotation – annotaiton to add to current image
- category – required if annotation is not an Annotation object
-
export
(style='coco')¶ Exports object into specified style
-
Mask Object¶
-
class
imantics.
Mask
(array)[source]¶ Mask class
-
contains
(item)[source]¶ Checks whether a point (tuple), array or mask is within current mask. Note: Masks and arrays must be fully contained to return True
Parameters: item – object to check Returns: boolean if item is contained
-
intersect
(other)[source]¶ Intersects the array of the specified mask with this masks’s array and returns the result as a new mask.
Parameters: other – mask (or numpy array) to intersect with Returns: resulting mask
-
iou
(other)[source]¶ Intersect over union value of the specified masks
Parameters: other – mask (or numpy array) to compute value with Returns: resulting float value
-