Types¶
The types
module provides data models for CVAT annotations and related objects. These classes are used to represent various annotation types and their attributes.
Annotation Types¶
Box
¶
A bounding box annotation in CVAT.
Boxes are used to define rectangular regions in images using top-left and bottom-right coordinates. They can be converted to polygons and segmentation masks.
ATTRIBUTE | DESCRIPTION |
---|---|
label |
The label/class name for this box
TYPE:
|
xtl |
X-coordinate of the top-left corner
TYPE:
|
ytl |
Y-coordinate of the top-left corner
TYPE:
|
xbr |
X-coordinate of the bottom-right corner
TYPE:
|
ybr |
Y-coordinate of the bottom-right corner
TYPE:
|
occluded |
Whether this box is occluded (0 for no, 1 for yes)
TYPE:
|
z_order |
The z-order/layer of this box
TYPE:
|
source |
The source of this annotation (e.g. "manual", "automatic")
TYPE:
|
attributes |
List of additional attributes for this box
TYPE:
|
Polygon
¶
A polygon annotation in CVAT.
Polygons are used to define regions in images using a series of connected points. They can be converted to segmentation masks and support various geometric operations.
ATTRIBUTE | DESCRIPTION |
---|---|
label |
The label/class name for this polygon
TYPE:
|
source |
The source of this annotation (e.g. "manual", "automatic")
TYPE:
|
occluded |
Whether this polygon is occluded (0 for no, 1 for yes)
TYPE:
|
points |
List of (x,y) coordinates defining the polygon vertices
TYPE:
|
z_order |
The z-order/layer of this polygon
TYPE:
|
attributes |
List of additional attributes for this polygon
TYPE:
|
Mask
¶
A binary mask annotation in CVAT.
Masks are used to store pixel-wise segmentations efficiently using run-length encoding (RLE). They can be created from numpy arrays or PIL Images and support various operations.
ATTRIBUTE | DESCRIPTION |
---|---|
label |
The label/class name for this mask
TYPE:
|
source |
The source of this annotation (e.g. "manual", "automatic")
TYPE:
|
occluded |
Whether this mask is occluded (0 for no, 1 for yes)
TYPE:
|
z_order |
The z-order/layer of this mask
TYPE:
|
rle |
Run-length encoded string representing the mask
TYPE:
|
top |
Top coordinate of the mask's bounding box
TYPE:
|
left |
Left coordinate of the mask's bounding box
TYPE:
|
height |
Height of the mask's bounding box
TYPE:
|
width |
Width of the mask's bounding box
TYPE:
|
attributes |
List of additional attributes for this mask
TYPE:
|
Polyline
¶
Container Types¶
ImageAnnotation
¶
Annotation data for a single image in CVAT.
Contains all annotation shapes (boxes, polygons, masks, polylines, ellipses) associated with an image.
ATTRIBUTE | DESCRIPTION |
---|---|
id |
Unique identifier for the image
TYPE:
|
name |
Filename of the image
TYPE:
|
subset |
Optional subset the image belongs to (e.g., "train", "test")
TYPE:
|
task_id |
ID of the task this image belongs to
TYPE:
|
job_id |
ID of the job this image belongs to
TYPE:
|
width |
Image width in pixels
TYPE:
|
height |
Image height in pixels
TYPE:
|
boxes |
List of bounding box annotations
TYPE:
|
polygons |
List of polygon annotations
TYPE:
|
masks |
List of mask annotations
TYPE:
|
polylines |
List of polyline annotations
TYPE:
|
ellipses |
List of ellipse annotations
TYPE:
|
Example
image = ImageAnnotation(
id="1",
name="frame_000001.jpg",
subset="train",
task_id="906591",
job_id="1247749",
width=1920,
height=1080,
boxes=[
Box(label="car", xtl=100, ytl=200, xbr=300, ybr=400)
],
masks=[
Mask(label="person", points="100,200;300,400", z_order=1)
],
ellipses=[
Ellipse(label="defect", cx=500, cy=600, rx=50, ry=30)
]
)
JobStatus
¶
Status information for a CVAT job.
Jobs are subdivisions of tasks that can be assigned to different annotators. Each job has a stage (e.g., "annotation") and state (e.g., "completed").
ATTRIBUTE | DESCRIPTION |
---|---|
task_id |
ID of the task this job belongs to
TYPE:
|
job_id |
Unique identifier for the job
TYPE:
|
task_name |
Name of the parent task
TYPE:
|
stage |
Current stage of the job (e.g., "annotation", "validation")
TYPE:
|
state |
Current state of the job (e.g., "completed", "in_progress")
TYPE:
|
assignee |
Username or details of the person assigned to the job
TYPE:
|
Example
# Create from job status data
status = JobStatus(
task_id="906591",
job_id=520016,
task_name="Batch 1",
stage="annotation",
state="completed",
assignee="john.doe"
)
# Create from CVAT SDK job object
status = JobStatus.from_job(job, task_name="Batch 1")
print(status.assignee_email) # Get assignee's email
Label Types¶
Label
¶
LabelAttribute
¶
Attribute
¶
Project Types¶
Project
¶
A CVAT project containing tasks and labels.
ATTRIBUTE | DESCRIPTION |
---|---|
id |
Unique identifier for the project
TYPE:
|
name |
Human-readable name of the project
TYPE:
|
created |
Timestamp when the project was created
TYPE:
|
updated |
Timestamp when the project was last updated
TYPE:
|
labels |
List of label definitions for the project
TYPE:
|
Example
project = Project(
id="217969",
name="My Project",
created="2024-01-01 12:00:00.000000+00:00",
updated="2024-01-01 12:00:00.000000+00:00",
labels=[
Label(name="car", color="#ff0000", type="any"),
Label(name="person", color="#00ff00", type="any")
]
)
Task
¶
A CVAT task representing a unit of work for annotation.
Tasks are created within projects and contain images to be annotated. Each task can be split into multiple jobs for parallel annotation.
ATTRIBUTE | DESCRIPTION |
---|---|
task_id |
Unique identifier for the task
TYPE:
|
name |
Human-readable name of the task
TYPE:
|
url |
Optional URL to access the task's data or API endpoint
TYPE:
|
Example
task = Task(
task_id="906591",
name="Batch 1",
url="https://app.cvat.ai/api/jobs/520016"
)