LabelingJobApi

class LabelingJobApi(api)[source]

Bases: RemoveableBulkModuleApi, ModuleWithStatus

API for working with labeling jobs.

Parameters:
api

Api object to use for API connection.

Usage Example:
import supervisely as sly
api = sly.Api.from_env()
jobs = api.labeling_job.get_list(9)

Methods

archive

Archives Labeling Job with given ID.

clone

Clone Labeling Job with given ID.

convert_info_to_json

Convert information about an entity to a dictionary.

create

Creates Labeling Job and assigns given Users to it.

exists

Checks if an entity with the given parent_id and name exists

get_activity

get_annotations

Return annotations for given image ids from labeling job with given id.

get_custom_data

Get custom data of Labeling Job with given ID.

get_free_name

Generates a free name for an entity with the given parent_id and name.

get_info_by_id

Get Labeling Job information by ID.

get_info_by_name

Get information about an entity by its name from the Supervisely server.

get_list

Get list of information about Labeling Job in the given Team.

get_list_all_pages

Get list of all or limited quantity entities from the Supervisely server.

get_list_all_pages_generator

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

get_list_idx_page_async

Get the list of items for a given page number.

get_list_page_generator_async

Yields list of images in dataset asynchronously page by page.

get_project_meta

Returns project meta with classes and tags used in the labeling job with given id.

get_stats

Get stats of given Labeling Job ID.

get_status

Get status of Labeling Job with given ID.

info_sequence

Sequence of fields that are returned by the API to represent LabelingJobInfo.

info_tuple_name

Name of the tuple that represents LabelingJobInfo.

raise_for_status

reject_annotations

Reject annotations for all or unmarked entities in the labeling job with given id.

remove

Remove an entity with the specified ID from the Supervisely server.

remove_batch

Remove entities in batches from the Supervisely server.

restart

Restart Labeling Job with given ID.

set_custom_data

Update or replace custom data of Labeling Job with given ID.

set_entity_review_status

Sets review status for entity with given ID.

set_status

Sets Labeling Job status.

stop

Makes Labeling Job unavailable for labeler with given User ID.

wait

Wait for a Labeling Job to change to the expected target status.

Attributes

MAX_WAIT_ATTEMPTS

Maximum number of attempts that will be made to wait for a certain condition to be met.

WAIT_ATTEMPT_TIMEOUT_SEC

Number of seconds for intervals between attempts.

InfoType

alias of LabelingJobInfo

class Status(*values)[source]

Bases: StrEnum

Labeling job lifecycle status values returned by the API.

classmethod has_value(value)

Check if a value is in the enum.

Parameters:
value : str

Value to check.

Returns:

True if value is in the enum, False otherwise.

Return type:

bool

classmethod values()

Get all values of the enum.

COMPLETED = 'completed'
IN_PROGRESS = 'in_progress'
ON_REVIEW = 'on_review'
PENDING = 'pending'
REVIEW_COMPLETED = 'review_completed'
STOPPED = 'stopped'
classmethod convert_info_to_json(info)

Convert information about an entity to a dictionary.

Parameters:
info : NamedTuple

Information about the entity.

Returns:

Dictionary with information about the entity.

Return type:

dict

static info_sequence()[source]

Sequence of fields that are returned by the API to represent LabelingJobInfo.

Usage Example:
LabelingJobInfo(
    id=2,
    name='Annotation Job (#1) (#1) (dataset_01)',
    readme='',
    description='',
    team_id=4,
    workspace_id=8,
    workspace_name='First Workspace',
    project_id=58,
    project_name='tutorial_project',
    dataset_id=54,
    dataset_name='dataset_01',
    created_by_id=4,
    created_by_login='anna',
    assigned_to_id=4,
    assigned_to_login='anna',
    reviewer_id=4,
    reviewer_login='anna',
    created_at='2020-04-08T15:10:12.618Z',
    started_at='2020-04-08T15:10:19.833Z',
    finished_at='2020-04-08T15:13:39.788Z',
    status='completed',
    disabled=False,
    labeling_queue_id=3,
    labeling_exam_id=None,
    images_count=3,
    finished_images_count=0,
    rejected_images_count=1,
    accepted_images_count=2,
    progress_images_count=2,
    classes_to_label=[],
    tags_to_label=[],
    images_range=(1, 5),
    objects_limit_per_image=None,
    tags_limit_per_image=None,
    filter_images_by_tags=[],
    include_images_with_tags=[],
    exclude_images_with_tags=[],
    entities=None,
    priority=2
)
static info_tuple_name()[source]

Name of the tuple that represents LabelingJobInfo.

archive(id)[source]

Archives Labeling Job with given ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

Returns:

None

Return type:

None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

api.labeling_job.archive(23)
clone(id, new_title=None, reviewer_id=None, assignee_ids=None)[source]

Clone Labeling Job with given ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

new_title : str, optional

New title for the job

reviewer_id : int, optional

ID of the reviewer

assignee_ids : List[int], optional

List of User IDs to assign the job

Returns:

List of information about Labeling Jobs.

Return type:

List[LabelingJobInfo]

create(name, dataset_id, user_ids, readme=None, description=None, classes_to_label=None, objects_limit_per_image=None, tags_to_label=None, tags_limit_per_image=None, include_images_with_tags=None, exclude_images_with_tags=None, images_range=None, reviewer_id=None, images_ids=[], dynamic_classes=False, dynamic_tags=False, disable_confirm=None, disable_submit=None, toolbox_settings=None, enable_quality_check=None, guide_id=None, allow_restore=False, read_only_tags=None)[source]

Creates Labeling Job and assigns given Users to it.

Parameters:
name : str

Labeling Job name in Supervisely.

dataset_id : int

Dataset ID in Supervisely.

user_ids : List[int]

User IDs in Supervisely to assign Users as labelers to Labeling Job.

readme : str, optional

Additional information about Labeling Job.

description : str, optional

Description of Labeling Job.

classes_to_label : List[str], optional

List of classes to label in Dataset.

objects_limit_per_image : int, optional

Limit the number of objects that the labeler can create on each image.

tags_to_label : List[str], optional

List of tags to label in Dataset.

tags_limit_per_image : int, optional

Limit the number of tags that the labeler can create on each image.

include_images_with_tags : List[str], optional

Include images with given tags for processing by labeler.

exclude_images_with_tags : List[str], optional

Exclude images with given tags for processing by labeler.

images_range : List[int, int], optional

Limit number of images to be labeled for each labeler.

reviewer_id : int, optional

User ID in Supervisely to assign User as Reviewer to Labeling Job.

images_ids : List[int], optional

List of images ids to label in dataset

dynamic_classes : bool, optional

If True, classes created after creating the job will be available for annotators

dynamic_tags : bool, optional

If True, tags created after creating the job will be available for annotators

disable_confirm : bool, optional

If True, the Confirm button will be disabled in the labeling tool. It will remain disabled until the next API call sets the parameter to False, re-enabling the button.

disable_submit : bool, optional

If True, the Submit button will be disabled in the labeling tool. It will remain disabled until the next API call sets the parameter to False, re-enabling the button.

toolbox_settings : Dict, optional

Settings for the labeling tool. Only video projects are supported.

enable_quality_check : bool, optional

If True, adds an intermediate step between “review” and completing the Labeling Job.

guide_id : int, optional

Guide ID in Supervisely to assign a guide to the Labeling Job.

allow_restore : bool

If True, allows restoring a previously deleted labeling job with the same name in the same dataset.

Returns:

List of LabelingJobInfo objects with information about new Labeling Jobs.

Return type:

List[LabelingJobInfo]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

user_name = 'alex'
dataset_id = 602
new_labeling_jobs = api.labeling_job.create(
    user_name,
    dataset_id,
    user_ids=[111, 222],
    readme='Readmy text',
    description='Work for labelers',
    objects_limit_per_image=5,
    tags_limit_per_image=3
)
print(new_labeling_jobs)

# >>> List[LabelingJobInfo(id=2,...)]

# Create video labeling job with toolbox settings

user_id = 4
dataset_id = 277
video_id = 24897
toolbox_settings = {"playbackRate": 32, "skipFramesSize": 15, "showVideoTime": True}

new_labeling_jobs = api.labeling_job.create(
name="Labeling Job name",
dataset_id=dataset_id,
user_ids=[user_id],
readme="Labeling Job readme",
description="Some description",
classes_to_label=["car", "animal"],
tags_to_label=["animal_age_group"],
images_ids=[video_id],
toolbox_settings=toolbox_settings,
)
print(new_labeling_jobs)

# >>> List[LabelingJobInfo(id=3,...)]
exists(parent_id, name)

Checks if an entity with the given parent_id and name exists

Parameters:
parent_id : int

ID of the parent entity.

name : str

Name of the entity.

Returns:

Returns True if entity exists, and False if not

Return type:

bool

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

name = "IMG_0315.jpeg"
dataset_id = 55832
exists = api.image.exists(dataset_id, name)
print(exists) # True
get_annotations(id, image_ids=None, project_meta=None, image_infos=None)[source]

Return annotations for given image ids from labeling job with given id. To speed up the process, you can provide image infos, which will be used instead of fetching them from the API.

Parameters:
id : int

Labeling Job ID in Supervisely.

image_ids : List[int], optional

Image IDs in Supervisely. If not provided, you must provide image_infos. Have lower priority than image_infos.

project_meta=None

Project meta of the labeling job with given id. Can be retrieved with get_project_meta().

image_infos=None

List of ImageInfo objects. If not provided, will be retrieved from the API. Have higher priority than image_ids.

Returns:

Annotation for given image id from labeling job with given id.

Return type:

Annotation

get_custom_data(id)[source]

Get custom data of Labeling Job with given ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

Returns:

Custom data of the job

Return type:

dict

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

custom_data = api.labeling_job.get_custom_data(9)
print(custom_data)
get_free_name(parent_id, name)

Generates a free name for an entity with the given parent_id and name. Adds an increasing suffix to original name until a unique name is found.

Parameters:
parent_id : int

ID of the parent entity.

name : str

Name of the entity.

Returns:

Returns free name.

Return type:

str

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

name = "IMG_0315.jpeg"
dataset_id = 55832
free_name = api.image.get_free_name(dataset_id, name)
print(free_name) # IMG_0315_001.jpeg
get_info_by_id(id)[source]

Get Labeling Job information by ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

Returns:

LabelingJobInfo object with information about the Labeling Job.

Return type:

LabelingJobInfo

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

label_job_info = api.labeling_job.get_info_by_id(2)
print(label_job_info)
# Output: [
#     2,
#     "Annotation Job (#1) (#1) (dataset_01)",
#     "",
#     "",
#     4,
#     8,
#     "First Workspace",
#     58,
#     "tutorial_project",
#     54,
#     "dataset_01",
#     4,
#     "anna",
#     4,
#     "anna",
#     4,
#     "anna",
#     "2020-04-08T15:10:12.618Z",
#     "2020-04-08T15:10:19.833Z",
#     "2020-04-08T15:13:39.788Z",
#     "completed",
#     false,
#     3,
#     0,
#     1,
#     2,
#     2,
#     [],
#     [],
#     [
#         1,
#         5
#     ],
#     null,
#     null,
#     [],
#     [],
#     [],
#     [
#         {
#             "reviewStatus": "rejected",
#             "id": 283,
#             "name": "image_03"
#         },
#         {
#             "reviewStatus": "accepted",
#             "id": 282,
#             "name": "image_02"
#         },
#         {
#             "reviewStatus": "accepted",
#             "id": 281,
#             "name": "image_01"
#         }
#     ]
# ]
get_info_by_name(parent_id, name, fields=[])

Get information about an entity by its name from the Supervisely server.

Parameters:
parent_id : int

ID of the parent entity.

name : str

Name of the entity for which the information is being retrieved.

fields : List[str]

The list of api fields which will be returned with the response.

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

dataset_id = 55832
name = "IMG_0315.jpeg"
info = api.image.get_info_by_name(dataset_id, name)
print(info)
# Output: ImageInfo(id=19369643, name='IMG_0315.jpeg', ...)
get_list(team_id, created_by_id=None, assigned_to_id=None, project_id=None, dataset_id=None, show_disabled=False, reviewer_id=None, is_part_of_queue=True, queue_ids=None, exclude_statuses=None)[source]

Get list of information about Labeling Job in the given Team.

Parameters:
team_id : int

Team ID in Supervisely.

created_by_id : int, optional

ID of the User who created the LabelingJob.

assigned_to_id : int, optional

ID of the assigned User.

project_id : int, optional

Project ID in Supervisely.

dataset_id : int, optional

Dataset ID in Supervisely.

show_disabled : bool, optional

Show disabled Labeling Jobs.

reviewer_id : int, optional

ID of the User who reviews the LabelingJob.

is_part_of_queue : bool, optional

Filter by Labeling Queue. If True, all existing Labeling Jobs are returned. If False, only Labeling Jobs that are not part of the queue are returned.

queue_ids : Union[List, int], optional

IDs of the Labeling Queues. If set, only Labeling Jobs from the selected queues are returned. Arg is_part_of_queue must be True.

exclude_statuses : List[Literal["pending", "in_progress", "on_review", "completed"]], optional

Exclude Labeling Jobs with given statuses.

Returns:

List of LabelingJobInfo objects with information about Labeling Jobs.

Return type:

List[LabelingJobInfo]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

label_jobs = api.labeling_job.get_list(4)
print(label_jobs)
# Output: [
#     [
#         2,
#         "Annotation Job (#1) (#1) (dataset_01)",
#         "",
#         "",
#         4,
#         8,
#         "First Workspace",
#         58,
#         "tutorial_project",
#         54,
#         "dataset_01",
#         4,
#         "anna",
#         4,
#         "anna",
#         4,
#         "anna",
#         "2020-04-08T15:10:12.618Z",
#         "2020-04-08T15:10:19.833Z",
#         "2020-04-08T15:13:39.788Z",
#         "completed",
#         false,
#         3,
#         null,
#         3,
#         0,
#         1,
#         2,
#         2,
#         [],
#         [],
#         [
#             1,
#             5
#         ],
#         null,
#         null,
#         [],
#         [],
#         [],
#         null
#     ],
#     [
#         3,
#         "Annotation Job (#1) (#2) (dataset_02)",
#         "",
#         "",
#         4,
#         8,
#         "First Workspace",
#         58,
#         "tutorial_project",
#         55,
#         "dataset_02",
#         4,
#         "anna",
#         4,
#         "anna",
#         4,
#         "anna",
#         "2020-04-08T15:10:12.618Z",
#         "2020-04-08T15:15:46.749Z",
#         "2020-04-08T15:17:33.572Z",
#         "completed",
#         false,
#         3,
#         null,
#         2,
#         0,
#         0,
#         2,
#         2,
#         [],
#         [],
#         [
#             1,
#             5
#         ],
#         null,
#         null,
#         [],
#         [],
#         [],
#         null
#     ]
# ]
get_list_all_pages(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

Get list of all or limited quantity entities from the Supervisely server.

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

Returns:

List of entities.

Return type:

List[dict]

get_list_all_pages_generator(method, data, progress_cb=None, convert_json_info_cb=None, limit=None, return_first_response=False)

This generator function retrieves a list of all or a limited quantity of entities from the Supervisely server, yielding batches of entities as they are retrieved

Parameters:
method : str

Request method name

data : dict

Dictionary with request body info

progress_cb : Progress, optional

Function for tracking download progress.

convert_json_info_cb : Callable, optional

Function for convert json info

limit : int, optional

Number of entity to retrieve

return_first_response : bool, optional

Specify if return first response

async get_list_idx_page_async(method, data)

Get the list of items for a given page number. Page number is specified in the data dictionary.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

Returns:

List of items.

Return type:

Tuple[int, List[NamedTuple]]

async get_list_page_generator_async(method, data, pages_count=None, semaphore=None)

Yields list of images in dataset asynchronously page by page.

Parameters:
method : str

Method to call for listing items.

data : dict

Data to pass to the API method.

pages_count : int, optional

Preferred number of pages to retrieve if used with a per_page limit. Will be automatically adjusted if the pagesCount differs from the requested number.

semaphore=None

Semaphore for limiting the number of simultaneous requests.

Returns:

List of images in dataset.

Return type:

AsyncGenerator[List[ImageInfo]]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

method = 'images.list'
data = {'datasetId': 123456}

loop = sly.utils.get_or_create_event_loop()
images = loop.run_until_complete(api.image.get_list_generator_async(method, data))
get_project_meta(id)[source]

Returns project meta with classes and tags used in the labeling job with given id.

Parameters:
id : int

Labeling Job ID in Supervisely.

Returns:

Project meta of the labeling job with given id.

Return type:

ProjectMeta

get_stats(id)[source]

Get stats of given Labeling Job ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

Returns:

Dict with information about given Labeling Job

Return type:

dict

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

status = api.labeling_job.get_stats(3)
print(status)
# Output: {
#     "job": {
#         "editingDuration": 0,
#         "annotationDuration": 720,
#         "id": 3,
#         "name": "Annotation Job (#1) (#2) (dataset_02)",
#         "startedAt": "2020-04-08T15:15:46.749Z",
#         "finishedAt": "2020-04-08T15:17:33.572Z",
#         "imagesCount": 2,
#         "finishedImagesCount": 2,
#         "tagsStats": [
#             {
#                 "id": 24,
#                 "color": "#ED68A1",
#                 "images": 1,
#                 "figures": 1,
#                 "name": "car_color"
#             },
#             {
#                 "id": 19,
#                 "color": "#A0A08C",
#                 "images": 0,
#                 "figures": 1,
#                 "name": "cars_number"
#             },
#             {
#                 "id": 20,
#                 "color": "#D98F7E",
#                 "images": 1,
#                 "figures": 1,
#                 "name": "like"
#             },
#             {
#                 "id": 23,
#                 "color": "#65D37C",
#                 "images": 0,
#                 "figures": 1,
#                 "name": "person_gender"
#             },
#             {
#                 "parentId": 23,
#                 "color": "#65D37C",
#                 "images": 0,
#                 "figures": 1,
#                 "name": "person_gender (male)"
#             },
#             {
#                 "parentId": 23,
#                 "color": "#65D37C",
#                 "images": 0,
#                 "figures": 0,
#                 "name": "person_gender (female)"
#             },
#             {
#                 "id": 21,
#                 "color": "#855D79",
#                 "images": 1,
#                 "figures": 1,
#                 "name": "situated"
#             },
#             {
#                 "parentId": 21,
#                 "color": "#855D79",
#                 "images": 1,
#                 "figures": 1,
#                 "name": "situated (inside)"
#             },
#             {
#                 "parentId": 21,
#                 "color": "#855D79",
#                 "images": 0,
#                 "figures": 0,
#                 "name": "situated (outside)"
#             },
#             {
#                 "id": 22,
#                 "color": "#A2B4FA",
#                 "images": 0,
#                 "figures": 1,
#                 "name": "vehicle_age"
#             },
#             {
#                 "parentId": 22,
#                 "color": "#A2B4FA",
#                 "images": 0,
#                 "figures": 1,
#                 "name": "vehicle_age (modern)"
#             },
#             {
#                 "parentId": 22,
#                 "color": "#A2B4FA",
#                 "images": 0,
#                 "figures": 0,
#                 "name": "vehicle_age (vintage)"
#             }
#         ]
#     },
#     "classes": [
#         {
#             "id": 43,
#             "color": "#F6FF00",
#             "shape": "rectangle",
#             "totalDuration": 0,
#             "imagesCount": 0,
#             "avgDuration": null,
#             "name": "bike",
#             "labelsCount": 0
#         },
#         {
#             "id": 42,
#             "color": "#BE55CE",
#             "shape": "polygon",
#             "totalDuration": 0,
#             "imagesCount": 0,
#             "avgDuration": null,
#             "name": "car",
#             "labelsCount": 0
#         },
#         {
#             "id": 41,
#             "color": "#FD0000",
#             "shape": "polygon",
#             "totalDuration": 0,
#             "imagesCount": 0,
#             "avgDuration": null,
#             "name": "dog",
#             "labelsCount": 0
#         },
#         {
#             "id": 40,
#             "color": "#00FF12",
#             "shape": "bitmap",
#             "totalDuration": 0,
#             "imagesCount": 0,
#             "avgDuration": null,
#             "name": "person",
#             "labelsCount": 0
#         }
#     ],
#     "images": {
#         "total": 2,
#         "images": [
#             {
#                 "id": 285,
#                 "reviewStatus": "accepted",
#                 "annotationDuration": 0,
#                 "totalDuration": 0,
#                 "name": "image_01",
#                 "labelsCount": 0
#             },
#             {
#                 "id": 284,
#                 "reviewStatus": "accepted",
#                 "annotationDuration": 0,
#                 "totalDuration": 0,
#                 "name": "image_02",
#                 "labelsCount": 0
#             }
#         ]
#     }
# }
get_status(id)[source]

Get status of Labeling Job with given ID.

Parameters:
id : int

Labeling job ID in Supervisely.

Returns:

Labeling Job Status

Return type:

Status

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

job_status = api.labeling_job.get_status(4)
print(job_status) # pending
reject_annotations(id, mode='all')[source]

Reject annotations for all or unmarked entities in the labeling job with given id.

Parameters:
id : int

Labeling Job ID in Supervisely.

mode : str, optional

Reject mode. Can be “all” or “unmarked”.

Returns:

None

Return type:

None

remove(id)

Remove an entity with the specified ID from the Supervisely server.

Parameters:
id : int

Entity ID in Supervisely.

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

image_id = 19369643
api.image.remove(image_id)
remove_batch(ids, progress_cb=None, batch_size=50)

Remove entities in batches from the Supervisely server. All entity IDs must belong to the same nesting (for example team, or workspace, or project, or dataset). Therefore, it is necessary to sort IDs before calling this method.

Parameters:
ids : List[int]

IDs of entities in Supervisely.

progress_cb : Callable

Function for control remove progress.

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

image_ids = [19369645, 19369646, 19369647]
api.image.remove_batch(image_ids)
restart(id, assignee_ids=None, reviewer_id=None, title=None, complete_existing=True, only_rejected_entities=True, ignore_no_rejected_error=False)[source]

Restart Labeling Job with given ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

assignee_ids : List[int], optional

List of User IDs to assign the job. If not set, the job will be assigned to the same user as the existing job.

reviewer_id : int, optional

ID of the reviewer

title : str, optional

New title for the job <= 255 characters

complete_existing : bool, optional

If False, existing job will not be completed.

only_rejected_entities : bool, optional

If False, all entities that do not have an “accepted” status will be included in new job, all unmarked entities will be rejected for the existing job.

ignore_errors : bool, optional

If True, the job will not be restarted if there are errors in request data.

Returns:

List of dicts with information about created Labeling Jobs.

Return type:

List[dict]

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

job_info_list = api.labeling_job.restart(222)

print(job_info_list)
# Output:
#   [
#       {
#           'id': 940,
#           'userId': 342,
#           'type': 'annotation',
#           'name': 'Annotation Job (#2)'
#       }
#   ]
set_custom_data(id, custom_data, update=True)[source]

Update or replace custom data of Labeling Job with given ID. By default, updates existing custom data. To replace it entirely, set update to False.

Parameters:
id : int

Labeling Job ID in Supervisely.

custom_data : dict

Custom data to set

update : bool

Whether to update existing custom data or replace it entirely.

Returns:

None

Return type:

None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

api.labeling_job.set_custom_data(9, {"key": "value"})
set_entity_review_status(id, entity_id, status)[source]

Sets review status for entity with given ID.

Parameters:
id : int

Labeling Job ID in Supervisely.

entity_id : int

Entity ID

status : str

New review status for entity

Returns:

None

Return type:

None

set_status(id, status)[source]

Sets Labeling Job status.

Parameters:
id : int

Labeling Job ID in Supervisely.

status : str

New Labeling Job status

Returns:

None

Return type:

None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

api.labeling_job.set_status(id=9, status="completed")
stop(id)[source]

Makes Labeling Job unavailable for labeler with given User ID.

Parameters:
id : int

User ID in Supervisely.

Returns:

None

Return type:

None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()
api.labeling_job.stop(9)
wait(id, target_status, wait_attempts=None, wait_attempt_timeout_sec=None)[source]

Wait for a Labeling Job to change to the expected target status.

Parameters:
id : int

Labeling Job ID in Supervisely.

target_status : str

Expected result status of Labeling Job.

wait_attempts : int, optional

Number of attempts to retry, when WaitingTimeExceeded raises.

wait_attempt_timeout_sec : int, optional

Time between attempts.

:raises WaitingTimeExceeded: if waiting time exceeded :returns: None :rtype: None

Usage Example:
import os
from dotenv import load_dotenv

import supervisely as sly

# Load secrets and create API object from .env file (recommended)
# Learn more here: https://developer.supervisely.com/getting-started/basics-of-authentication
if sly.is_development():
    load_dotenv(os.path.expanduser("~/supervisely.env"))

api = sly.Api.from_env()

api.labeling_job.wait(4, 'completed', wait_attempts=2, wait_attempt_timeout_sec=1)
# supervisely.api.module_api.WaitingTimeExceeded: Waiting time exceeded