CVAT Python SDK
Overview
CVAT SDK is a Python library. It provides you access to Python functions and objects thatsimplify server interaction and provide additional functionality like data validationand serialization.
SDK API includes several layers:
- Low-level API with REST API wrappers. Located at
cvat_sdk.api_client
.Read more - High-level API. Located at
cvat_sdk.core
.Read more - PyTorch adapter. Located at
cvat_sdk.pytorch
.Read more - Auto-annotation API. Located at
cvat_sdk.auto_annotation
.Read more - Miscellaneous utilities, grouped by topic.Located at
cvat_sdk.attributes
andcvat_sdk.masks
.
In general, the low-level API provides single-request operations, while the high-level oneimplements composite, multi-request operations, and provides local proxies for server objects.For most uses, the high-level API should be good enough, and it should bethe right point to start your integration with CVAT.
The PyTorch adapter is a specialized layerthat represents datasets stored in CVAT as PyTorchDataset
objects.This enables direct use of such datasets in PyTorch-based machine learning pipelines.
The auto-annotation API is a specialized layerthat lets you automatically annotate CVAT datasetsby running a custom function on the local machine.See also theauto-annotate
command in the CLI.
Installation
To install anofficial release of CVAT SDK use this command:
pip install cvat-sdk
To use thecvat_sdk.masks
module, request themasks
extra:
pip install"cvat-sdk[masks]"
To use the PyTorch adapter or the built-in PyTorch-based auto-annotation functions,request thepytorch
extra:
pip install"cvat-sdk[pytorch]"
We support Python versions 3.9 and higher.
Usage
To import package components, use the following code:
For the high-level API:
importcvat_sdk# orimportcvat_sdk.core
For the low-level API:
importcvat_sdk.api_client
For the PyTorch adapter:
importcvat_sdk.pytorch