Supervisely
About SuperviselyEcosystemContact usSlack
  • 💻Supervisely Developer Portal
  • 🎉Getting Started
    • Installation
    • Basics of authentication
    • Intro to Python SDK
    • Environment variables
    • Supervisely annotation format
      • Project Structure
      • Project Meta: Classes, Tags, Settings
      • Objects
      • Tags
      • Image Annotation
      • Video Annotation
      • Point Clouds Annotation
      • Point Cloud Episode Annotation
      • Volumes Annotation
    • Python SDK tutorials
      • Images
        • Images
        • Image and object tags
        • Spatial labels on images
        • Keypoints (skeletons)
        • Multispectral images
        • Multiview images
        • Advanced: Optimized Import
        • Advanced: Export
      • Videos
        • Videos
        • Video and object tags
        • Spatial labels on videos
      • Point Clouds
        • Point Clouds (LiDAR)
        • Point Cloud Episodes and object tags
        • 3D point cloud object segmentation based on sensor fusion and 2D mask guidance
        • 3D segmentation masks projection on 2D photo context image
      • Volumes
        • Volumes (DICOM)
        • Spatial labels on volumes
      • Common
        • Iterate over a project
        • Iterate over a local project
        • Progress Bar tqdm
        • Cloning projects for development
    • Command Line Interface (CLI)
      • Enterprise CLI Tool
        • Instance administration
        • Workflow automation
      • Supervisely SDK CLI
    • Connect your computer
      • Linux
      • Windows WSL
      • Troubleshooting
  • 🔥App development
    • Basics
      • Create app from any py-script
      • Configuration file
        • config.json
        • Example 1. Headless
        • Example 2. App with GUI
        • v1 - Legacy
          • Example 1. v1 Modal Window
          • Example 2. v1 app with GUI
      • Add private app
      • Add public app
      • App Compatibility
    • Apps with GUI
      • Hello World!
      • App in the Image Labeling Tool
      • App in the Video Labeling Tool
      • In-browser app in the Labeling Tool
    • Custom import app
      • Overview
      • From template - simple
      • From scratch - simple
      • From scratch GUI - advanced
      • Finding directories with specific markers
    • Custom export app
      • Overview
      • From template - simple
      • From scratch - advanced
    • Neural Network integration
      • Overview
      • Serving App
        • Introduction
        • Instance segmentation
        • Object detection
        • Semantic segmentation
        • Pose estimation
        • Point tracking
        • Object tracking
        • Mask tracking
        • Image matting
        • How to customize model inference
        • Example: Custom model inference with probability maps
      • Serving App with GUI
        • Introduction
        • How to use default GUI template
        • Default GUI template customization
        • How to create custom user interface
      • Inference API
      • Training App
        • Overview
        • Tensorboard template
        • Object detection
      • High level scheme
      • Custom inference pipeline
      • Train and predict automation model pipeline
    • Advanced
      • Advanced debugging
      • How to make your own widget
      • Tutorial - App Engine v1
        • Chapter 1 Headless
          • Part 1 — Hello world! [From your Python script to Supervisely APP]
          • Part 2 — Errors handling [Catching all bugs]
          • Part 3 — Site Packages [Customize your app]
          • Part 4 — SDK Preview [Lemons counter app]
          • Part 5 — Integrate custom tracker into Videos Annotator tool [OpenCV Tracker]
        • Chapter 2 Modal Window
          • Part 1 — Modal window [What is it?]
          • Part 2 — States and Widgets [Customize modal window]
        • Chapter 3 UI
          • Part 1 — While True Script [It's all what you need]
          • Part 2 — UI Rendering [Simplest UI Application]
          • Part 3 — APP Handlers [Handle Events and Errors]
          • Part 4 — State and Data [Mutable Fields]
          • Part 5 — Styling your app [Customizing the UI]
        • Chapter 4 Additionals
          • Part 1 — Remote Developing with PyCharm [Docker SSH Server]
      • Custom Configuration
        • Fixing SSL Certificate Errors in Supervisely
        • Fixing 400 HTTP errors when using HTTP instead of HTTPS
      • Autostart
      • Coordinate System
      • MLOps Workflow integration
    • Widgets
      • Input
        • Input
        • InputNumber
        • InputTag
        • BindedInputNumber
        • DatePicker
        • DateTimePicker
        • ColorPicker
        • TimePicker
        • ClassesMapping
        • ClassesColorMapping
      • Controls
        • Button
        • Checkbox
        • RadioGroup
        • Switch
        • Slider
        • TrainValSplits
        • FileStorageUpload
        • Timeline
        • Pagination
      • Text Elements
        • Text
        • TextArea
        • Editor
        • Copy to Clipboard
        • Markdown
        • Tooltip
        • ElementTag
        • ElementTagsList
      • Media
        • Image
        • LabeledImage
        • GridGallery
        • Video
        • VideoPlayer
        • ImagePairSequence
        • Icons
        • ObjectClassView
        • ObjectClassesList
        • ImageSlider
        • Carousel
        • TagMetaView
        • TagMetasList
        • ImageAnnotationPreview
        • ClassesMappingPreview
        • ClassesListPreview
        • TagsListPreview
        • MembersListPreview
      • Selection
        • Select
        • SelectTeam
        • SelectWorkspace
        • SelectProject
        • SelectDataset
        • SelectItem
        • SelectTagMeta
        • SelectAppSession
        • SelectString
        • Transfer
        • DestinationProject
        • TeamFilesSelector
        • FileViewer
        • Dropdown
        • Cascader
        • ClassesListSelector
        • TagsListSelector
        • MembersListSelector
        • TreeSelect
        • SelectCudaDevice
      • Thumbnails
        • ProjectThumbnail
        • DatasetThumbnail
        • VideoThumbnail
        • FolderThumbnail
        • FileThumbnail
      • Status Elements
        • Progress
        • NotificationBox
        • DoneLabel
        • DialogMessage
        • TaskLogs
        • Badge
        • ModelInfo
        • Rate
        • CircleProgress
      • Layouts and Containers
        • Card
        • Container
        • Empty
        • Field
        • Flexbox
        • Grid
        • Menu
        • OneOf
        • Sidebar
        • Stepper
        • RadioTabs
        • Tabs
        • TabsDynamic
        • ReloadableArea
        • Collapse
        • Dialog
        • IFrame
      • Tables
        • Table
        • ClassicTable
        • RadioTable
        • ClassesTable
        • RandomSplitsTable
        • FastTable
      • Charts and Plots
        • LineChart
        • GridChart
        • HeatmapChart
        • ApexChart
        • ConfusionMatrix
        • LinePlot
        • GridPlot
        • ScatterChart
        • TreemapChart
        • PieChart
      • Compare Data
        • MatchDatasets
        • MatchTagMetas
        • MatchObjClasses
        • ClassBalance
        • CompareAnnotations
      • Widgets demos on github
  • 😎Advanced user guide
    • Objects binding
    • Automate with Python SDK & API
      • Start and stop app
      • User management
      • Labeling Jobs
  • 🖥️UI widgets
    • Element UI library
    • Supervisely UI widgets
    • Apexcharts - modern & interactive charts
    • Plotly graphing library
  • 📚API References
    • REST API Reference
    • Python SDK Reference
Powered by GitBook
On this page
  • Introduction
  • How to debug this tutorial
  • Labeling Jobs automation
  • Import libraries
  • Init API client
  • Get your IDs and username from environment
  • Prepare project for Labeling Job
  • Labeling jobs automation
  • Step 1. Create and add annotators to the team, before creating Labeling Job
  • Step 2. Define project and datasets for labeling job
  • Step 3. Create Labeling Jobs
  • Labeling Jobs filtering
  • Labeling Jobs Statuses
  • Archive Labeling Job
  • Remove Labeling Jobs

Was this helpful?

Edit on GitHub
  1. Advanced user guide
  2. Automate with Python SDK & API

Labeling Jobs

Guide explains how to manage labeling jobs using Supervisely SDK and

PreviousUser management

Last updated 2 years ago

Was this helpful?

Introduction

In this tutorial you will learn how to manage Labeling Jobs using Supervisely SDK and API.

📗 Everything you need to reproduce : source code and demo data.

How to debug this tutorial

Step 1. Prepare ~/supervisely.env file with credentials.

Step 2. Clone with source code and demo data and create .

git clone https://github.com/supervisely-ecosystem/automation-with-python-sdk-and-api
cd automation-with-python-sdk-and-api
./create_venv.sh

Step 3. Open repository directory in Visual Studio Code.

code -r .

Step 4. change ✅ IDs ✅ in local.env file by copying the IDs from Supervisely instance.

  • Change Team ID in local.env file by copying the ID from the context menu of the team.

    TEAM_ID=8                 # ⬅️ change it
  • Get project from ecosystem. Lemons (Test) is an example project with 6 images of lemons and kiwi fruits.

Change project id in local.env file by copying the ID from the context menu of the project.

PROJECT_ID=5555                 # ⬅️ change it
  • Change User ID and user login in local.env to your own from Team members page.

    USER_ID=7                 # ⬅️ change it
    USER_LOGIN="my_username"  # ⬅️ change it

Step 5. Start debugging examples/labeling-jobs-automation/main.py

Labeling Jobs automation

Import libraries

import os
from dotenv import load_dotenv
import supervisely as sly

Init API client

​Init API for communicating with Supervisely Instance. First, we load environment variables with credentials:

if sly.is_development():
    load_dotenv("local.env")
    load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api.from_env()

Get your IDs and username from environment

TEAM_ID = sly.env.team_id()
PROJECT_ID = sly.env.project_id()
USER_ID = sly.env.user_id()
USER_LOGIN = sly.env.user_login()

Prepare project for Labeling Job

Function will populate project meta with classes: "kiwi", "lemon", and tags: "size", "origin".

prepare_project(api=api, id=PROJECT_ID)

Labeling jobs automation

Step 1. Create and add annotators to the team, before creating Labeling Job

Create accounts for annotators with restrictions.

Note: Creating users requires admin permission.

labeler_1 = api.user.get_info_by_login(login='labeler_1')
if labeler_1 is None:
    labeler_1 = api.user.create(login='labeler_1', password='11111abc', is_restricted=True)

labeler_2 = api.user.get_info_by_login(login='labeler_2')
if labeler_2 is None:
    labeler_2 = api.user.create(login='labeler_2', password='22222abc', is_restricted=True)

Labelers will be able to login only after being added to at least one team

Note: Adding users to the Team requires admin permission.

if api.user.get_team_role(labeler_1.id, TEAM_ID) is None:
    api.user.add_to_team(labeler_1.id, TEAM_ID, api.role.DefaultRole.ANNOTATOR)
if api.user.get_team_role(labeler_2.id, TEAM_ID) is None:
    api.user.add_to_team(labeler_2.id, TEAM_ID, api.role.DefaultRole.ANNOTATOR)

Step 2. Define project and datasets for labeling job

project_meta_json = api.project.get_meta(PROJECT_ID)
project_meta = sly.ProjectMeta.from_json(project_meta_json)
print(project_meta)

Output:

ProjectMeta:
Object Classes
+-------+--------+----------------+--------+
|  Name | Shape  |     Color      | Hotkey |
+-------+--------+----------------+--------+
|  kiwi | Bitmap |  [208, 2, 27]  |        |
| lemon | Bitmap | [80, 227, 194] |        |
+-------+--------+----------------+--------+
Tags
+--------+--------------+------------------------------+--------+---------------+--------------------+
|  Name  |  Value type  |       Possible values        | Hotkey | Applicable to | Applicable classes |
+--------+--------------+------------------------------+--------+---------------+--------------------+
| origin |  any_string  |             None             |        |  objectsOnly  | ['kiwi', 'lemon']  |
|  size  | oneof_string | ['small', 'medium', 'large'] |        |  objectsOnly  | ['kiwi', 'lemon']  |
+--------+--------------+------------------------------+--------+---------------+--------------------+
datasets = api.dataset.get_list(project.id)
print(datasets)

Output:

[
  DatasetInfo(
    id=10555, 
    name='ds1',
    description='', 
    size='1277440',
    project_id=5555,
    images_count=6, 
    created_at='2022-10-18T15:39:57.377Z',
    updated_at='2022-10-18T15:39:57.377Z'
  )
]

Step 3. Create Labeling Jobs

Create labeling job for labeler 1, and assign class lemon to label.

created_jobs = api.labeling_job.create(name='labeler1_lemons_task',
                                       dataset_id=datasets[0].id,
                                       user_ids=[labeler_1.id],
                                       readme='annotation manual for fruits in markdown format here (optional)',
                                       description='short description is here (optional)',
                                       classes_to_label=["lemon"])
print(created_jobs)

Output:

[
  LabelingJobInfo(
      id=1, 
      name='labeler1_lemons_task', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=7,
      created_by_login='my_username', 
      assigned_to_id=101, 
      assigned_to_login='labeler_1',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=[],
      tags_to_label=[], 
      images_range=(None, None), 
      objects_limit_per_image=None, 
      tags_limit_per_image=None,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
        {
          'reviewStatus': 'none', 
          'id': 3882702, 
          'name': 'IMG_8144.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882697, 
          'name': 'IMG_4451.jpeg'
        },
        {
          'reviewStatus': 'none',
          'id': 3882698,
          'name': 'IMG_3861.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882700, 
          'name': 'IMG_2084.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882701, 
          'name': 'IMG_1836.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882699,
          'name': 'IMG_0748.jpeg'
        }
      ]
  )
]

You can stop Labeling Job if you need. Job will become unavailable for labeler.

api.labeling_job.stop(created_jobs[0].id)

Create labeling job for labeler 2, and assign class kiwi to label, and also tags "size" and "origin", with objects and tags limit. You can also specify which images to label by providing images ids.

List all images in dataset and get their IDs. As an example we will select only half of images in the dataset.

dataset_images_infos = api.image.get_list(dataset_id=datasets[0].id)
dataset_images_ids = [image_info.id for image_info in dataset_images_infos]
selected_images_ids = dataset_images_ids[:len(dataset_images_ids) // 2]
created_jobs = api.labeling_job.create(
                                name='labeler2_kiwi_task_with_complex_settings',
                                dataset_id=datasets[0].id,
                                user_ids=[labeler_2.id],
                                readme='annotation manual for fruits in markdown format here (optional)',
                                description='short description is here (optional)',
                                classes_to_label=["kiwi"],
                                objects_limit_per_image=10,
                                tags_to_label=["size", "origin"],
                                tags_limit_per_image=20,
                                images_ids=selected_images_ids
                                )
print(created_jobs)

Output:

[
  LabelingJobInfo(
      id=2, 
      name='labeler2_kiwi_task_with_complex_settings', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=100,
      created_by_login='my_username', 
      assigned_to_id=102, 
      assigned_to_login='labeler_2',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=["kiwi"],
      tags_to_label=["size", "origin"], 
      images_range=(None, None), 
      objects_limit_per_image=10, 
      tags_limit_per_image=20,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
          {
            'reviewStatus': 'none', 
            'id': 3882697, 
            'name': 'IMG_4451.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882698, 
            'name': 'IMG_3861.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882699, 
            'name': 'IMG_0748.jpeg'
          }
      ]
  )
]

Get all labeling jobs in a team

jobs = api.labeling_job.get_list(TEAM_ID)
print(jobs)

Output:

[
  LabelingJobInfo(
      id=1, 
      name='labeler1_lemons_task', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=7,
      created_by_login='my_username', 
      assigned_to_id=101, 
      assigned_to_login='labeler_1',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=[],
      tags_to_label=[], 
      images_range=(None, None), 
      objects_limit_per_image=None, 
      tags_limit_per_image=None,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
        {
          'reviewStatus': 'none', 
          'id': 3882702, 
          'name': 'IMG_8144.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882697, 
          'name': 'IMG_4451.jpeg'
        },
        {
          'reviewStatus': 'none',
          'id': 3882698,
          'name': 'IMG_3861.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882700, 
          'name': 'IMG_2084.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882701, 
          'name': 'IMG_1836.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882699,
          'name': 'IMG_0748.jpeg'
        }
      ]
  ),
  LabelingJobInfo(
      id=2, 
      name='labeler2_kiwi_task_with_complex_settings', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=100,
      created_by_login='my_username', 
      assigned_to_id=102, 
      assigned_to_login='labeler_2',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=["kiwi"],
      tags_to_label=["size", "origin"], 
      images_range=(None, None), 
      objects_limit_per_image=10, 
      tags_limit_per_image=20,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
          {
            'reviewStatus': 'none', 
            'id': 3882697, 
            'name': 'IMG_4451.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882698, 
            'name': 'IMG_3861.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882699, 
            'name': 'IMG_0748.jpeg'
          }
      ]
  )
]

Labeling Jobs filtering

List of available filters:

  • created_by_id

  • assigned_to_id

  • project_id

  • dataset_id

Note: filters can be used in various combinations

Get all labeling jobs that were created by user 'my_username'

Note: Getting UserInfo by login requires admin permission.

user = api.user.get_info_by_login(USER_LOGIN)
jobs = api.labeling_job.get_list(TEAM_ID, created_by_id=user.id)
print(jobs)

Output

[
  LabelingJobInfo(
      id=1, 
      name='labeler1_lemons_task', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=7,
      created_by_login='my_username', 
      assigned_to_id=101, 
      assigned_to_login='labeler_1',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=[],
      tags_to_label=[], 
      images_range=(None, None), 
      objects_limit_per_image=None, 
      tags_limit_per_image=None,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
        {
          'reviewStatus': 'none', 
          'id': 3882702, 
          'name': 'IMG_8144.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882697, 
          'name': 'IMG_4451.jpeg'
        },
        {
          'reviewStatus': 'none',
          'id': 3882698,
          'name': 'IMG_3861.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882700, 
          'name': 'IMG_2084.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882701, 
          'name': 'IMG_1836.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882699,
          'name': 'IMG_0748.jpeg'
        }
      ]
  ),
  LabelingJobInfo(
      id=2, 
      name='labeler2_kiwi_task_with_complex_settings', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=100,
      created_by_login='my_username', 
      assigned_to_id=102, 
      assigned_to_login='labeler_2',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=["kiwi"],
      tags_to_label=["size", "origin"], 
      images_range=(None, None), 
      objects_limit_per_image=10, 
      tags_limit_per_image=20,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
          {
            'reviewStatus': 'none', 
            'id': 3882697, 
            'name': 'IMG_4451.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882698, 
            'name': 'IMG_3861.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882699, 
            'name': 'IMG_0748.jpeg'
          }
      ]
  )
]

Get all labeling jobs that were created by user "my_username" and were assigned to labeler 2

jobs = api.labeling_job.get_list(TEAM_ID, created_by_id=user.id, assigned_to_id=labeler_2.id)
print(jobs)

Output:

[
  LabelingJobInfo(
      id=2, 
      name='labeler2_kiwi_task_with_complex_settings', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=100,
      created_by_login='my_username', 
      assigned_to_id=102, 
      assigned_to_login='labeler_2',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=["kiwi"],
      tags_to_label=["size", "origin"], 
      images_range=(None, None), 
      objects_limit_per_image=10, 
      tags_limit_per_image=20,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
          {
            'reviewStatus': 'none', 
            'id': 3882697, 
            'name': 'IMG_4451.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882698, 
            'name': 'IMG_3861.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882699, 
            'name': 'IMG_0748.jpeg'
          }
      ]
  )
]

Get all active labeling jobs in a team

jobs = api.labeling_job.get_list(TEAM_ID)
print(jobs)

Output:

[
  LabelingJobInfo(
      id=1, 
      name='labeler1_lemons_task', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=7,
      created_by_login='my_username', 
      assigned_to_id=101, 
      assigned_to_login='labeler_1',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=[],
      tags_to_label=[], 
      images_range=(None, None), 
      objects_limit_per_image=None, 
      tags_limit_per_image=None,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
        {
          'reviewStatus': 'none', 
          'id': 3882702, 
          'name': 'IMG_8144.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882697, 
          'name': 'IMG_4451.jpeg'
        },
        {
          'reviewStatus': 'none',
          'id': 3882698,
          'name': 'IMG_3861.jpeg'
        }, 
        {
          'reviewStatus': 'none', 
          'id': 3882700, 
          'name': 'IMG_2084.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882701, 
          'name': 'IMG_1836.jpeg'
        }, 
        {
          'reviewStatus': 'none',
          'id': 3882699,
          'name': 'IMG_0748.jpeg'
        }
      ]
  ),
  LabelingJobInfo(
      id=2, 
      name='labeler2_kiwi_task_with_complex_settings', 
      readme='annotation manual for fruits in markdown format here (optional)',
      description='short description is here (optional)', 
      team_id=8,
      workspace_id=349,
      workspace_name='Testing Workspace', 
      project_id=5555,
      project_name='Lemons (Test)', 
      dataset_id=10555,
      dataset_name='ds1', 
      created_by_id=100,
      created_by_login='my_username', 
      assigned_to_id=102, 
      assigned_to_login='labeler_2',
      created_at='2022-10-05T08:42:30.588Z', 
      started_at=None, 
      finished_at=None,
      status='pending',
      disabled=False, 
      images_count=6, 
      finished_images_count=0, 
      rejected_images_count=0,
      accepted_images_count=0,
      classes_to_label=["kiwi"],
      tags_to_label=["size", "origin"], 
      images_range=(None, None), 
      objects_limit_per_image=10, 
      tags_limit_per_image=20,
      filter_images_by_tags=[], 
      include_images_with_tags=[],
      exclude_images_with_tags=[],
      entities=[
          {
            'reviewStatus': 'none', 
            'id': 3882697, 
            'name': 'IMG_4451.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882698, 
            'name': 'IMG_3861.jpeg'
          }, 
          {
            'reviewStatus': 'none', 
            'id': 3882699, 
            'name': 'IMG_0748.jpeg'
          }
      ]
  )
]

Labeling Jobs Statuses

api.labeling_job.Status.PENDING - labeling job is created, labeler still has not started api.labeling_job.Status.IN_PROGRESS - labeler started, but not finished api.labeling_job.Status.ON_REVIEW - labeler finished his job, reviewer is in progress api.labeling_job.Status.COMPLETED - reviewer completed job api.labeling_job.Status.STOPPED - job was stopped at some stage

job_id = jobs[-2].id
api.labeling_job.get_status(job_id)

Output

<Status.STOPPED: 'stopped'>
job_id = jobs[-1].id
api.labeling_job.get_status(job_id)

Output:

<Status.PENDING: 'pending'>

If you want to change Labeling Job status you can use api.labeling_job.set_status() method

job_id = jobs[-1].id
api.labeling_job.set_status(id=job_id, status="completed")

Output:

<Status.COMPLETED: 'completed'>

The following methods will wait until labeling job will change status to the given expected status:

  • Labeler has finished annotating

    api.labeling_job.wait(job_id, target_status=api.labeling_job.Status.ON_REVIEW)
  • Reviewer has finished his annotation review

    api.labeling_job.wait(job_id, target_status=api.labeling_job.Status.COMPLETED) 

Archive Labeling Job

Archive Labeling job by ID. Data can be retrieved after archiving.

api.labeling_job.archive(jobs[0].id)

Remove Labeling Jobs

Labeling job will be removed permanently.

Remove single Labeling Job

Remove Labeling job by ID.

job_id = 278
api.labeling_job.remove(job_id)

Remove list of Labeling Jobs

Remove Labeling jobs by IDs.

job_ids = [279, 280, 281]
api.labeling_job.remove_batch(job_ids)

😎
this tutorial is on GitHub
repository
Virtual Environment
Lemons (Test)
Learn more here.
Created Labeling Jobs
Archived Labelling Job