yarrow.yarrow_cls.Annotation

class yarrow.yarrow_cls.Annotation(contributor: Contributor, name: Optional[str] = None, images: Optional[List[Image]] = None, categories: Optional[List[Category]] = None, comment: Optional[str] = None, segmentation: Optional[Union[List[List[float]], RLE]] = None, is_crowd: Optional[int] = None, polygon: Optional[List[List[float]]] = None, polyline: Optional[List[List[float]]] = None, mask: Optional[RLE] = None, area: Optional[float] = None, bbox: Optional[List[float]] = None, keypoints: Optional[List[List[Union[int, float]]]] = None, num_keypoints: Optional[int] = None, weight: Optional[float] = None, date_captured: Optional[datetime] = None, meta: Optional[dict] = None, **kwargs)

Bases: object

__init__(contributor: Contributor, name: Optional[str] = None, images: Optional[List[Image]] = None, categories: Optional[List[Category]] = None, comment: Optional[str] = None, segmentation: Optional[Union[List[List[float]], RLE]] = None, is_crowd: Optional[int] = None, polygon: Optional[List[List[float]]] = None, polyline: Optional[List[List[float]]] = None, mask: Optional[RLE] = None, area: Optional[float] = None, bbox: Optional[List[float]] = None, keypoints: Optional[List[List[Union[int, float]]]] = None, num_keypoints: Optional[int] = None, weight: Optional[float] = None, date_captured: Optional[datetime] = None, meta: Optional[dict] = None, **kwargs) None

Annotation class, can handle bbox, polygon, mask and keypoint annotation types and a single annotation can be applied to multiple images.

```python images = [Image(…), …] multi_layer = MultiLayer(images=images, …)

annot = Annotation(images = images, …) # or annot = Annotation(images = multi_layer.images, …)

yar_set = YarrowDataset(info=Info(…))

yar_set.add_annotation(annot) yar_set.add_multilayer(multi_layer) ```

Args:

contributor (Contributor): contributor, human or machine that generated the annotation images (List[Image]): images to which the annotation applies name (str, optional): annotation name, not classification. Defaults to None. categories (List[Category]): categories classifying the annotation comment (str, optional): simple string comment. Defaults to None. segmentation (Union[RLE, List[List[float]]], optional): DEPRECATED, contains a mask or a polygon. Defaults to None. is_crowd (int, optional): DEPRECATED, 0 if segmentation contains a polygon, 1 if it contains a mask. Defaults to 0. polygon (List[List[float]], optional): A polygon made of points, it is assumed that the shape is closed, DO NOT add the first point at the end of the list polyline (List[List[float]], optional): A line made of points mask (RLE, optional): area (float, optional): relative surface area of the image covered by the annotation. Defaults to None. bbox (List[float], optional): bounding box, order[left, top, right, bot]. Defaults to None. keypoints (List[List[Union[int, float]]], optional): keypoint annotation, [[x,y,v], …]; v=0 not labeled, v=1 labeled not visible, v=2 labeled and visible. Defaults to None. num_keypoints (int, optional): number of labelled keypoints. Defaults to None. weight (float, optional): weight given to the quality of the annotation. Defaults to None. date_captured (datetime, optional): datetime at which the annotation was created. Defaults to None. meta (dict, optional): a free metadata information key. If the Annotation cannot hold your information then put it here

Methods

__init__(contributor[, name, images, ...])

Annotation class, can handle bbox, polygon, mask and keypoint annotation types and a single annotation can be applied to multiple images.

pydantic([reset])

Returns the pydanic equivalent class of this object, should not be used directly, use only if you know what you are doing

pydantic(reset: bool = False) Annotation_pydantic

Returns the pydanic equivalent class of this object, should not be used directly, use only if you know what you are doing

Args:

reset (bool, optional): regenerates the pydantic class, using it will reset the id. Defaults to False.

Returns:

type(Annotation_pydantic)