Properties
-
asset_id
UUID of the Asset holding this Annotation -
dataset_version_id
UUID of DatasetVersion holding this Annotation -
duration
Duration time of this Annotation -
status
Status of this Annotation -
worker_id
UUID of the Worker that created this Annotation
Methods
update
update(
worker: Optional[Worker] = None, duration: Union[float, int, None] = None,
status: Union[AnnotationStatus, str, None] = None
)
Description
Update this annotation with a new worker, a new duration or a new status.
Examples
one_annotation.update(status=AnnotationStatus.ACCEPTED)
Arguments
-
worker (Worker, optional) : Worker of this annotation. Defaults to None.
-
duration (float, optional) : Duration of this annotation. Defaults to None.
-
status (AnnotationStatus, optional) : Status of this annotation. Defaults to None.
delete
delete()
Description
Delete this annotation from the platform.
All annotations shapes will be deleted!
This is a very dangerous move.
⚠️ DANGER ZONE: Be very careful here!
Examples
one_annotation.delete()
overwrite
overwrite(
rectangles: Optional[list[tuple[int, int, int, int, Label]]] = None,
polygons: Optional[list[tuple[list[list[int]], Label]]] = None,
classifications: Optional[list[Label]] = None,
lines: Optional[list[tuple[list[list[int]], Label]]] = None,
points: Optional[list[tuple[list[int], int, Label]]] = None,
duration: Union[float, int] = 0.0
)
Description
Overwrite content of this annotation with a new duration and new shapes
⚠️ DANGER ZONE: Be very careful here!
Examples
one_annotation.overwrite(rectangles=[(10, 20, 30, 40, label_cat), (50, 60, 20, 30, label_dog)])
Arguments
-
rectangles (list[tuple[int, int, int, int, Label]], optional) : List of rectangles to overwrite. Defaults to None.
-
polygons (list[tuple[list[list[int]], Label]], optional) : List of polygons to overwrite. Defaults to None.
-
classifications (list[Label], optional) : List of classifications to overwrite. Defaults to None.
-
lines (list[tuple[list[list[int]], Label]], optional) : List of lines to overwrite. Defaults to None.
-
points (list[tuple[list[int], int, Label]], optional) : List of points to overwrite. Defaults to None.
-
duration (Union[float, int], optional) : Duration of this annotation. Defaults to 0.0.
list_rectangles
list_rectangles()
Description
Retrieve all rectangles of this annotation
Examples
rects = one_annotation.list_rectangles()
Returns
List of Rectangle objects.
create_rectangle
create_rectangle(
x: int, y: int, w: int, h: int, label: Label
)
Description
Create a rectangle into this annotation.
Examples
rect = one_annotation.create_rectangle(420, 69, 100, 10, label_car)
Arguments
-
x (int) : x coordinate of the rectangle.
-
y (int) : y coordinate of the rectangle.
-
w (int) : width of the rectangle.
-
h (int) : height of the rectangle.
-
label Label : Label of the rectangle.
Returns
A Rectangle object.
create_multiple_rectangles
create_multiple_rectangles(
rectangles: list[tuple[int, int, int, int, Label]]
)
Description
Create some rectangles into this annotation.
Examples
rects = one_annotation.create_multiple_rectangles([(420, 69, 100, 10, label_car), (123, 456, 20, 20, label_person)])
Arguments
- rectangles (list[tuple[int, int, int, int, Label]]) : List of rectangles to create.
Returns
List of Rectangle objects.
list_polygons
list_polygons()
Description
Retrieve all polygons of this annotation
Examples
polys = one_annotation.list_polygons()
Returns
List of Polygon objects.
create_polygon
create_polygon(
coords: list[list[int]], label: Label
)
Description
Create a polygon into this annotation.
Examples
poly = one_annotation.create_polygon([[0, 0], [0, 1], [1, 1], [0, 0]], label_car)
Arguments
-
coords (list[list[int]]) : List of coordinates of the polygon.
-
label Label : Label of the polygon.
Returns
A Polygon object.
create_multiple_polygons
create_multiple_polygons(
polygons: list[tuple[list[list[int]], Label]]
)
Description
Create some polygons into this annotation.
Examples
polys = one_annotation.create_multiple_polygons([([[0, 0], [0, 1], [1, 1], [0, 0]] label_car), ([[0, 2], [0, 3], [1, 2], [0, 2]] label_person)])
Arguments
- polygons (list[tuple[list[list[int]], Label]]) : List of polygons to create.
Returns
List of Polygon objects.
list_lines
list_lines()
Description
Retrieve all lines of this annotation
Examples
lines = one_annotation.list_lines()
Returns
List of Line objects.
create_line
create_line(
coords: list[list[int]], label: Label
)
Description
Create a line into this annotation.
Examples
line = one_annotation.create_line([[0, 0], [0, 1], [1, 1], [0, 0]], label_car)
Arguments
-
coords (list[list[int]]) : List of coordinates of the line.
-
label Label : Label of the line.
Returns
A Line object.
create_multiple_lines
create_multiple_lines(
lines: list[tuple[list[list[int]], Label]]
)
Description
Create some lines into this annotation.
Examples
lines = one_annotation.create_multiple_lines([([[0, 0], [0, 1], [1, 1]] label_car), ([[0, 2], [0, 3], [1, 2]] label_person)])
Arguments
- lines (list[tuple[list[list[int]], Label]]) : List of lines to create.
Returns
List of Line objects.
list_points
list_points()
Description
Retrieve all points of this annotation
Examples
points = one_annotation.list_points()
Returns
List of Point objects.
create_point
create_point(
coords: list[int], order: int, label: Label
)
Description
Create a point into this annotation.
Examples
poly = one_annotation.create_point([0, 0], 1, label_car)
Arguments
-
coords (list[int]) : List of coordinates of the point.
-
order (int) : Order of the point.
-
label Label : Label of the point.
Returns
A Point object.
create_multiple_points
create_multiple_points(
points: list[tuple[list[int], int, Label]]
)
Description
Create some points into this annotation.
Examples
polys = one_annotation.create_multiple_points([([0, 0], label_car), ([0, 2], label_person)])
Arguments
- points (list[tuple[list[int], int, Label]]) : List of points to create.
Returns
List of Point objects.
list_classifications
list_classifications()
Description
Retrieve all classifications of this annotation
Examples
classifications = one_annotation.list_classifications()
Returns
List of Classification objects.
create_classification
create_classification(
label: Label
)
Description
Create a classification into this annotation.
Examples
classifications = one_annotation.create_classification(label_car)
Arguments
- label Label : Label of the classification.
Returns
A Classification object.
create_multiple_classifications
create_multiple_classifications(
classifications: list[Label]
)
Description
Create some classifications into this annotation.
Examples
polys = one_annotation.create_multiple_classifications([label_car, label_person])
Arguments
- classifications (list[Label]) : List of classifications to create.
Returns
List of Classification objects.