class documentation

A class to facilitate connection to and management of tasks in CVAT.

On initialization, this class constructs a session based on the provided server url and credentials.

This API provides methods to easily get, put, post, patch, and delete tasks and jobs through the formatted urls specified by the CVAT REST API.

Additionally, samples and label schemas can be uploaded and annotations downloaded through this class.

Parameters
namethe name of the backend
urlurl of the CVAT server
usernamethe CVAT username
emailthe CVAT email
passwordthe CVAT password
headersan optional dict of headers to add to all requests
organizationthe name of the organization to use when sending requests to CVAT
Method __init__ Undocumented
Method base_job_url Undocumented
Method base_task_url Undocumented
Method close Closes the API session.
Method create_project Creates a project on the CVAT server using the given label schema.
Method create_task Creates a task on the CVAT server using the given label schema.
Method delete Sends a DELETE request to the given CVAT API URL.
Method delete_project Deletes the given project from the CVAT server.
Method delete_projects Deletes the given projects from the CVAT server.
Method delete_task Deletes the given task from the CVAT server.
Method delete_tasks Deletes the given tasks from the CVAT server.
Method download_annotations Download the annotations from the CVAT server for the given results instance and parses them into the appropriate FiftyOne types.
Method get Sends a GET request to the given CVAT API URL.
Method get_empty_projects Check all given project ids to determine if they are empty or if they contain at least one task.
Method get_project_id Retrieves the CVAT project ID for the first instance of the given project name.
Method get_project_name Retrieves the CVAT project name for the given project ID.
Method get_project_tasks Returns the IDs of the tasks in the given project.
Method get_user_id Retrieves the CVAT user ID for the given username.
Method job_annotation_url Undocumented
Method job_url Undocumented
Method jobs_url Undocumented
Method labels_url Undocumented
Method launch_editor Launches the CVAT editor in your default web browser.
Method list_projects Returns the list of project IDs.
Method list_tasks Returns the list of task IDs.
Method patch Sends a PATCH request to the given CVAT API URL.
Method post Sends a POST request to the given CVAT API URL.
Method project_exists Checks if the given project exists.
Method project_id_search_url Undocumented
Method project_search_url Undocumented
Method project_url Undocumented
Method projects_page_url Undocumented
Method put Sends a PUT request to the given CVAT API URL.
Method task_annotation_formatted_url Undocumented
Method task_annotation_url Undocumented
Method task_data_download_url Undocumented
Method task_data_meta_url Undocumented
Method task_data_url Undocumented
Method task_exists Checks if the given task exists.
Method task_id_search_url Undocumented
Method task_status_url Undocumented
Method task_url Undocumented
Method taskless_job_url Undocumented
Method tasks_page_url Undocumented
Method upload_data Uploads a list of media to the task with the given ID.
Method upload_samples Uploads the given samples to CVAT according to the given backend's annotation and server configuration.
Method user_search_url Undocumented
Property about_url Undocumented
Property assignee_key Undocumented
Property base_api_url Undocumented
Property base_url Undocumented
Property login_url Undocumented
Property projects_url Undocumented
Property server_version Undocumented
Property tasks_url Undocumented
Property users_url Undocumented
Method _add_label_to_results Undocumented
Method _add_organization Undocumented
Method _add_project_label_ids Undocumented
Method _add_referer Undocumented
Method _add_shapes_to_tracks Undocumented
Method _build_cvat_schema Undocumented
Method _build_frame_id_map Undocumented
Method _compute_expected_frames Undocumented
Method _convert_cvat_schema Undocumented
Method _convert_polylines Undocumented
Method _convert_polylines_to_masks Undocumented
Method _create_classification_tags Undocumented
Method _create_detection_shapes Undocumented
Method _create_keypoint_shapes Undocumented
Method _create_polyline_shapes Undocumented
Method _create_scalar_tags Undocumented
Method _create_segmentation_shapes Undocumented
Method _create_server_id_map Undocumented
Method _create_shapes_tags_tracks Undocumented
Method _create_task_upload_data Undocumented
Method _ensure_one_field_per_type Undocumented
Method _filter_field_classes Undocumented
Method _finalize_track Undocumented
Method _finalize_tracks Undocumented
Method _get_attr_class_maps Undocumented
Method _get_batch_size Undocumented
Method _get_cvat_schema Undocumented
Method _get_ignored_types When uploading multiple fields to an existing project, each field must have a different type but can have overlapping class names. Therefore, when loading annotations, if a field exists for a found label type, that label will not be loaded with any other fields.
Method _get_job_ids Undocumented
Method _get_label_schema Undocumented
Method _get_paginated_results Undocumented
Method _get_project_labels Undocumented
Method _get_return_label_types Undocumented
Method _get_segmentation_id Undocumented
Method _get_task_id_labels_json Undocumented
Method _get_task_labels Undocumented
Method _get_value_from_search Undocumented
Method _get_value_update_map Undocumented
Method _has_ignored_attributes Undocumented
Method _is_empty_project Undocumented
Method _login Undocumented
Method _make_request Undocumented
Method _merge_results Undocumented
Method _merge_tracks Undocumented
Method _parse_annotation Undocumented
Method _parse_arg Undocumented
Method _parse_label Undocumented
Method _parse_local_files Undocumented
Method _parse_project_details Undocumented
Method _parse_reviewers Undocumented
Method _parse_shapes_tags Undocumented
Method _remap_ids Undocumented
Method _remap_track_ids Undocumented
Method _setup Undocumented
Method _to_cvat_attributes Undocumented
Method _update_shapes_tags_tracks Undocumented
Method _upload_annotations Undocumented
Method _validate Undocumented
Method _verify_uploaded_frames Undocumented
Instance Variable _email Undocumented
Instance Variable _headers Undocumented
Instance Variable _name Undocumented
Instance Variable _organization Undocumented
Instance Variable _password Undocumented
Instance Variable _project_id_map Undocumented
Instance Variable _server_version Undocumented
Instance Variable _session Undocumented
Instance Variable _url Undocumented
Instance Variable _user_id_map Undocumented
Instance Variable _username Undocumented

Inherited from AnnotationAPI:

Method __enter__ Undocumented
Method __exit__ Undocumented
Method _prompt_api_key Undocumented
Method _prompt_username_password Undocumented
def __init__(self, name, url, username=None, email=None, password=None, headers=None, organization=None): (source)

Undocumented

def base_job_url(self, task_id, job_id): (source)

Undocumented

def base_task_url(self, task_id): (source)

Undocumented

def close(self): (source)

Closes the API session.

def create_project(self, name, schema=None): (source)

Creates a project on the CVAT server using the given label schema.

Parameters
namea name for the project
schema:Nonethe label schema to use for the created project
Returns
the ID of the created project in CVAT
def create_task(self, name, schema=None, segment_size=None, image_quality=75, task_assignee=None, project_id=None, issue_tracker=None): (source)

Creates a task on the CVAT server using the given label schema.

Parameters
namea name for the task
schema:Nonethe label schema to use for the created task
segment_size:Nonemaximum number of images to load into a job. Not applicable to videos
image_quality:75an int in [0, 100] determining the image quality to upload to CVAT
task_assignee:Nonethe username to assign the created task(s)
project_id:Nonethe ID of a project to which upload the task
issue_tracker:Nonethe URL of an issue tracker to link the task
Returns
a tuple of
  • task_id: the ID of the created task in CVAT
  • class_id_map: a dictionary mapping the IDs assigned to classes by CVAT
  • attr_id_map: a dictionary mapping the IDs assigned to attributes by CVAT for every class
def delete(self, url, **kwargs): (source)

Sends a DELETE request to the given CVAT API URL.

Parameters
urlthe url to send the request to
**kwargsadditional request parameters
Returns
the request response
def delete_project(self, project_id): (source)

Deletes the given project from the CVAT server.

Parameters
project_idthe project ID
def delete_projects(self, project_ids, progress=None): (source)

Deletes the given projects from the CVAT server.

Parameters
project_idsan iterable of project IDs
progress:Nonewhether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead
def delete_task(self, task_id): (source)

Deletes the given task from the CVAT server.

Parameters
task_idthe task ID
def delete_tasks(self, task_ids, progress=None): (source)

Deletes the given tasks from the CVAT server.

Parameters
task_idsan iterable of task IDs
progress:Nonewhether to render a progress bar (True/False), use the default value fiftyone.config.show_progress_bars (None), or a progress callback function to invoke instead
def download_annotations(self, results): (source)

Download the annotations from the CVAT server for the given results instance and parses them into the appropriate FiftyOne types.

Parameters
resultsa CVATAnnotationResults
Returns
the annotations dict
def get(self, url, **kwargs): (source)

Sends a GET request to the given CVAT API URL.

Parameters
urlthe url
**kwargsadditional request parameters
Returns
the request response
def get_empty_projects(self, project_ids): (source)

Check all given project ids to determine if they are empty or if they contain at least one task.

Parameters
project_idsa list of project ids to check
Returns
a list of empty project ids
def get_project_id(self, project_name): (source)

Retrieves the CVAT project ID for the first instance of the given project name.

Parameters
project_namethe name of the project
Returns
the project ID, or None if no project with the given name was found
def get_project_name(self, project_id): (source)

Retrieves the CVAT project name for the given project ID.

Parameters
project_idthe ID of the project
Returns
the project name, or None if no project with the given ID was found
def get_project_tasks(self, project_id): (source)

Returns the IDs of the tasks in the given project.

Parameters
project_ida project ID
Returns
the list of task IDs
def get_user_id(self, username): (source)

Retrieves the CVAT user ID for the given username.

Parameters
usernamethe username
Returns
the user ID, or None if the user was not found
def job_annotation_url(self, job_id): (source)

Undocumented

def job_url(self, task_id, job_id): (source)

Undocumented

def jobs_url(self, task_id): (source)

Undocumented

def labels_url(self, task_id): (source)

Undocumented

def launch_editor(self, url=None): (source)

Launches the CVAT editor in your default web browser.

Parameters
url:Nonean optional URL to open. By default, the base URL of the server is opened
def list_projects(self): (source)

Returns the list of project IDs.

Returns
the list of project IDs
def list_tasks(self): (source)

Returns the list of task IDs.

Returns
the list of task IDs
def patch(self, url, **kwargs): (source)

Sends a PATCH request to the given CVAT API URL.

Parameters
urlthe url
**kwargsadditional request parameters
Returns
the request response
def post(self, url, **kwargs): (source)

Sends a POST request to the given CVAT API URL.

Parameters
urlthe url
**kwargsadditional request parameters
Returns
the request response
def project_exists(self, project_id): (source)

Checks if the given project exists.

Parameters
project_idthe project ID
Returns
True/False
def project_id_search_url(self, project_id): (source)

Undocumented

def project_search_url(self, project_name): (source)

Undocumented

def project_url(self, project_id): (source)

Undocumented

def projects_page_url(self, page_number): (source)

Undocumented

def put(self, url, **kwargs): (source)

Sends a PUT request to the given CVAT API URL.

Parameters
urlthe url
**kwargsadditional request parameters
Returns
the request response
def task_annotation_formatted_url(self, task_id, anno_filepath, anno_format='CVAT 1.1'): (source)

Undocumented

def task_annotation_url(self, task_id): (source)

Undocumented

def task_data_download_url(self, task_id, frame_id, data_type='frame', quality='original'): (source)

Undocumented

def task_data_meta_url(self, task_id): (source)

Undocumented

def task_data_url(self, task_id): (source)

Undocumented

def task_exists(self, task_id): (source)

Checks if the given task exists.

Parameters
task_idthe task ID
Returns
True/False
def task_id_search_url(self, task_id): (source)

Undocumented

def task_status_url(self, task_id): (source)

Undocumented

def task_url(self, task_id): (source)

Undocumented

def taskless_job_url(self, job_id): (source)

Undocumented

def tasks_page_url(self, page_number): (source)

Undocumented

def upload_data(self, task_id, paths, image_quality=75, use_cache=True, use_zip_chunks=True, chunk_size=None, job_assignees=None, job_reviewers=None, frame_start=None, frame_stop=None, frame_step=None): (source)

Uploads a list of media to the task with the given ID.

Parameters
task_idthe task ID
pathsa list of media paths to upload
image_quality:75an int in [0, 100] determining the image quality to upload to CVAT
use_cache:Truewhether to use a cache when uploading data. Using a cache reduces task creation time as data will be processed on-the-fly and stored in the cache when requested
use_zip_chunks:Truewhen annotating videos, whether to upload video frames in smaller chunks. Setting this option to False may result in reduced video quality in CVAT due to size limitations on ZIP files that can be uploaded to CVAT
chunk_size:Nonethe number of frames to upload per ZIP chunk
job_assignees:Nonea list of usernames to assign jobs
job_reviewers:Nonea list of usernames to assign job reviews
frame_start:Nonean optional first frame to start uploading from
frame_stop:Nonean optional last frame to upload
frame_step:Nonean optional positive integer specifying the spacing between frames to upload
Returns
a list of the job IDs created for the task
def upload_samples(self, samples, anno_key, backend): (source)

Uploads the given samples to CVAT according to the given backend's annotation and server configuration.

Parameters
samplesa fiftyone.core.collections.SampleCollection
anno_keythe annotation key
backenda CVATBackend to use to perform the upload
Returns
a CVATAnnotationResults
def user_search_url(self, username): (source)

Undocumented

Undocumented

@property
assignee_key = (source)

Undocumented

@property
base_api_url = (source)

Undocumented

Undocumented

Undocumented

@property
projects_url = (source)

Undocumented

@property
server_version = (source)

Undocumented

Undocumented

Undocumented

def _add_label_to_results(self, results, label_type, label, seg_id=None): (source)

Undocumented

def _add_organization(self): (source)

Undocumented

def _add_project_label_ids(self, project_id, labels): (source)

Undocumented

def _add_referer(self): (source)

Undocumented

def _add_shapes_to_tracks(self, tracks, shapes, class_name, index, frame_id, immutable_attrs, keyframe, group_id=0): (source)

Undocumented

def _build_cvat_schema(self, label_schema, occluded_attr=None, group_id_attr=None): (source)

Undocumented

def _build_frame_id_map(self, samples): (source)

Undocumented

def _compute_expected_frames(self, samples, frame_start, frame_stop, frame_step): (source)

Undocumented

def _convert_cvat_schema(self, label_schema, project_id=None, task_id=None, occluded_attr=None, group_id_attr=None, update_server=True): (source)

Undocumented

def _convert_polylines(self, label_id, label, label_info, frame_size): (source)

Undocumented

def _convert_polylines_to_masks(self, results, label_info, frames_metadata): (source)

Undocumented

def _create_classification_tags(self, classifications, cvat_schema, label_field, frame_id, frame_size, label_type=None): (source)

Undocumented

def _create_detection_shapes(self, detections, cvat_schema, label_field, frame_id, frame_size, label_type=None, label_id=None, load_tracks=False, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _create_keypoint_shapes(self, keypoints, cvat_schema, label_field, frame_id, frame_size, label_type=None, load_tracks=False, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _create_polyline_shapes(self, polylines, cvat_schema, label_field, frame_id, frame_size, label_type=None, load_tracks=False, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _create_scalar_tags(self, label, cvat_schema, label_field, frame_id, frame_size, label_type=None, assign_scalar_attrs=False): (source)

Undocumented

def _create_segmentation_shapes(self, segmentation, cvat_schema, label_field, frame_id, frame_size, label_type=None, mask_targets=None): (source)

Undocumented

def _create_server_id_map(self, anno_resp, attr_id_map): (source)

Undocumented

def _create_shapes_tags_tracks(self, samples, label_field, label_info, cvat_schema, frame_start, frame_stop, frame_step, assign_scalar_attrs=False, load_tracks=False, only_keyframes=False, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _create_task_upload_data(self, config, idx, task_name, cvat_schema, project_id, samples_batch, task_ids, job_ids, frame_id_map, frame_start, frame_stop, frame_step): (source)

Undocumented

def _ensure_one_field_per_type(self, label_schema, verbose=True): (source)

Undocumented

def _filter_field_classes(self, tags, shapes, tracks, _cvat_classes): (source)

Undocumented

def _finalize_track(self, track, frame_count, only_keyframes): (source)

Undocumented

def _finalize_tracks(self, tracks, frame_count, only_keyframes): (source)

Undocumented

def _get_attr_class_maps(self, task_id): (source)

Undocumented

def _get_batch_size(self, samples, task_size): (source)

Undocumented

def _get_cvat_schema(self, label_schema, project_id=None, occluded_attr=None, group_id_attr=None): (source)

Undocumented

def _get_ignored_types(self, project_id, label_types, label_type, is_last_field): (source)

When uploading multiple fields to an existing project, each field must have a different type but can have overlapping class names. Therefore, when loading annotations, if a field exists for a found label type, that label will not be loaded with any other fields.

def _get_job_ids(self, task_id): (source)

Undocumented

def _get_label_schema(self, project_id=None, task_id=None, occluded_attr=None, group_id_attr=None): (source)

Undocumented

def _get_paginated_results(self, base_url, get_page_url=None, value=None): (source)

Undocumented

def _get_project_labels(self, project_id): (source)

Undocumented

def _get_return_label_types(self, label_schema, label_fields): (source)

Undocumented

def _get_segmentation_id(self, id_map, sample_id, frame_id): (source)

Undocumented

def _get_task_id_labels_json(self, task_json): (source)

Undocumented

def _get_task_labels(self, task_id): (source)

Undocumented

def _get_value_from_search(self, search_url_fcn, target, target_key, value_key): (source)

Undocumented

def _get_value_update_map(self, name, id_map, result_name, search_url_fcn): (source)

Undocumented

def _has_ignored_attributes(self, label_schema): (source)

Undocumented

def _is_empty_project(self, project_id): (source)

Undocumented

def _login(self, username, password, email=None): (source)

Undocumented

def _make_request(self, request_method, url, print_error_info=True, **kwargs): (source)

Undocumented

def _merge_results(self, results, new_results): (source)

Undocumented

def _merge_tracks(self, tracks, new_tracks): (source)

Undocumented

def _parse_annotation(self, anno, results, anno_type, prev_type, frame_id_map, expected_label_type, id_map, server_id_map, class_map, attr_id_map, frames, ignore_types, assigned_scalar_attrs=False, track_index=None, track_group_id=None, immutable_attrs=None, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _parse_arg(self, arg, config_arg): (source)

Undocumented

def _parse_label(self, label, cvat_schema, label_field, label_id=None, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _parse_local_files(self, paths): (source)

Undocumented

def _parse_project_details(self, project_name, project_id): (source)

Undocumented

def _parse_reviewers(self, job_reviewers): (source)

Undocumented

def _parse_shapes_tags(self, anno_type, annos, frame_id_map, label_type, id_map, server_id_map, class_map, attr_id_map, frames, ignore_types, frame_stop, frame_step, assigned_scalar_attrs=False, track_index=None, track_group_id=None, immutable_attrs=None, occluded_attrs=None, group_id_attrs=None): (source)

Undocumented

def _remap_ids(self, shapes_or_tags, class_id_map, attr_id_map): (source)

Undocumented

def _remap_track_ids(self, tracks, class_id_map, attr_id_map): (source)

Undocumented

def _setup(self): (source)

Undocumented

def _to_cvat_attributes(self, attributes): (source)

Undocumented

def _update_shapes_tags_tracks(self, tags, shapes, tracks, id_map, label_type, samples_batch, label_field, label_info, cvat_schema, frame_start, frame_stop, frame_step, assign_scalar_attrs, only_keyframes, occluded_attrs, group_id_attrs): (source)

Undocumented

def _upload_annotations(self, anno_shapes, anno_tags, anno_tracks, class_id_map, attr_id_map, task_id): (source)

Undocumented

def _validate(self, response, kwargs): (source)

Undocumented

def _verify_uploaded_frames(self, task_id, samples, frame_start, frame_stop, frame_step): (source)

Undocumented

Undocumented

_headers = (source)

Undocumented

Undocumented

_organization = (source)

Undocumented

_password = (source)

Undocumented

_project_id_map: dict = (source)

Undocumented

_server_version = (source)

Undocumented

_session = (source)

Undocumented

Undocumented

_user_id_map: dict = (source)

Undocumented

_username = (source)

Undocumented