This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Automated Annotation

Learn how to leverage AI models and automation tools in CVAT to speed up labeling and improve consistency.

1 - Overview

Automatic annotation of tasks

Automatic annotation in CVAT is a tool that you can use to automatically pre-annotate your data with pre-trained models.

CVAT can use models from the following sources:

The following table describes the available options:

Self-hosted Online
Price Free See Pricing
Models You have to add models You can use pre-installed models
Hugging Face & Roboflow
integration
Not supported Supported
AI Agent Functions Supported (Enterprise) Supported (SAM2 tracking available)

See:

Running Automatic annotation

To start automatic annotation, do the following:

  1. On the top menu, click Tasks.

  2. Find the task you want to annotate and click Action > Automatic annotation.

    Task with opened “Actions” menu

  3. In the Automatic annotation dialog, from the drop-down list, select a model.

  4. Match the labels of the model and the task.

  5. (Optional) In case you need the model to return masks as polygons, switch toggle Return masks as polygons.

  6. (Optional) In case you need to remove all previous annotations, switch toggle Clean old annotations.

  7. (Optional) You can specify a Threshold for the model. If not provided, the default value from the model settings will be used.

    Automatic annotation window displaying the selected YOLOv3 model and parameters

  8. Click Annotate.

CVAT will show the progress of annotation on the progress bar.

Progress bar

You can stop the automatic annotation at any moment by clicking cancel.

Labels matching

Each model is trained on a dataset and supports only the dataset’s labels.

For example:

  • DL model has the label car.
  • Your task (or project) has the label vehicle.

To annotate, you need to match these two labels to give CVAT a hint that, in this case, car = vehicle.

If you have a label that is not on the list of DL labels, you will not be able to match them.

For this reason, supported DL models are suitable only for certain labels.

To check the list of labels for each model, see Models papers and official documentation.

Models

Automatic annotation uses pre-installed and added models.

List of pre-installed models:

Model Description
Attributed face detection Three OpenVINO models work together:

  • Face Detection 0205: face detector based on MobileNetV2 as a backbone with a FCOS head for indoor and outdoor scenes shot by a front-facing camera.
  • Emotions recognition retail 0003: fully convolutional network for recognition of five emotions (‘neutral’, ‘happy’, ‘sad’, ‘surprise’, ‘anger’).
  • Age gender recognition retail 0013: fully convolutional network for simultaneous Age/Gender recognition. The network can recognize the age of people in the [18 - 75] years old range; it is not applicable for children since their faces were not in the training set.
  • RetinaNet R101 RetinaNet is a one-stage object detection model that utilizes a focal loss function to address class imbalance during training. Focal loss applies a modulating term to the cross entropy loss to focus learning on hard negative examples. RetinaNet is a single, unified network composed of a backbone network and two task-specific subnetworks.

    For more information, see:
  • Site: RetinaNET
  • Text detection Text detector based on PixelLink architecture with MobileNetV2, depth_multiplier=1.4 as a backbone for indoor/outdoor scenes.

    For more information, see:
  • Site: OpenVINO Text detection 004
  • YOLO v3 YOLO v3 is a family of object detection architectures and models pre-trained on the COCO dataset.

    For more information, see:
  • Site: YOLO v3
  • YOLO v7 YOLOv7 is an advanced object detection model that outperforms other detectors in terms of both speed and accuracy. It can process frames at a rate ranging from 5 to 160 frames per second (FPS) and achieves the highest accuracy with 56.8% average precision (AP) among real-time object detectors running at 30 FPS or higher on the V100 graphics processing unit (GPU).

    For more information, see:
  • GitHub: YOLO v7
  • Paper: YOLO v7
  • Adding models from Hugging Face and Roboflow

    In case you did not find the model you need, you can add a model of your choice from Hugging Face or Roboflow.

    For more information, see Streamline annotation by integrating Hugging Face and Roboflow models.

    This video demonstrates the process:

    2 - Segment Anything 2 Tracker

    Accelerating video labeling using SAM2 model

    Overview

    Segment Anything 2 is a segmentation model that allows fast and precise selection of any object in videos or images. SAM2 tracking is available in two implementations:

    1. Nuclio SAM2 Tracker: Available only for Enterprise deployments. This is implemented as a serverless function deployed via Nuclio framework.

    2. AI Agent SAM2 Tracker: Available for CVAT Online and Enterprise via auto-annotation (AA) functions that run on user-side agents. This brings SAM2 tracking capabilities to CVAT Online users who previously couldn’t access this feature.

    It is strongly recommended to deploy the model using a GPU. Although it is possible to use a CPU-based version, it generally performs much slower and is suitable only for handling a single parallel request. The AI agent variant runs on user hardware, providing flexibility for GPU usage without server configuration requirements.

    Unlike a regular tracking model, both SAM2 tracker implementations are designed to be applied to existing objects (polygons and masks) to track them forward for a specified number of frames.

    How to install

    Choose the installation method based on your platform and deployment needs.

    Nuclio SAM2 Tracker (CVAT Enterprise)

    Docker

    You can use existing scripts from the community repository (./serverless/deploy_cpu.sh or ./serverless/deploy_gpu.sh). To deploy the feature, simply run:

    ./serverless/deploy_gpu.sh "path/to/the/function"
    

    Kubernetes

    • You need to deploy the Nuclio function manually. Note that this function requires a Redis storage configured to keep the tracking state. You may use the same storage as cvat_redis_ondisk uses. When running the nuclio deploy command, make sure to provide the necessary arguments. The minimal command is:
    nuctl deploy "path/to/the/function"
      --env CVAT_FUNCTIONS_REDIS_HOST="<redis_host>"
      --env CVAT_FUNCTIONS_REDIS_PORT="<redis_port>"
      --env CVAT_FUNCTIONS_REDIS_PASSWORD="<redis_password>" # if applicable
    

    AI Agent SAM2 Tracker (CVAT Online + Enterprise)

    The AI agent implementation enables SAM2 tracking for CVAT Online users and provides an alternative deployment method for Enterprise customers. This approach runs the tracking model on user hardware via auto-annotation (AA) functions.

    Prerequisites

    • Python 3.10 or later
    • Git
    • CVAT Online account or Enterprise instance
    • Optional: NVIDIA GPU with CUDA support for faster inference

    Setup Instructions

    1. Clone the CVAT repository:

      git clone https://github.com/cvat-ai/cvat.git <CVAT_DIR>
      
    2. Install required dependencies:

      pip install cvat-cli -r <CVAT_DIR>/ai-models/tracker/sam2/requirements.txt
      
    3. Register the SAM2 function with CVAT:

      cvat-cli --server-host <CVAT_BASE_URL> --auth <USERNAME>:<PASSWORD> \
          function create-native "SAM2" \
          --function-file=<CVAT_DIR>/ai-models/tracker/sam2/func.py -p model_id=str:<MODEL_ID>
      
    4. Run the AI agent:

      cvat-cli --server-host <CVAT_BASE_URL> --auth <USERNAME>:<PASSWORD> \
          function run-agent <FUNCTION_ID> \
          --function-file=<CVAT_DIR>/ai-models/tracker/sam2/func.py -p model_id=str:<MODEL_ID>
      

    Parameter Reference

    • <CVAT_BASE_URL>: Your CVAT instance URL (e.g., https://app.cvat.ai)
    • <USERNAME> and <PASSWORD>: Your CVAT credentials
    • <FUNCTION_ID>: The ID returned by the function create-native command
    • <MODEL_ID>: A SAM2 model ID from Hugging Face Hub (e.g., facebook/sam2.1-hiera-tiny)

    Optional Parameters

    • GPU Support: Add -p device=str:cuda to the agent command to use NVIDIA GPU acceleration
    • Organization Sharing: Add --org <ORG_SLUG> to both commands to share the function with your organization

    Agent Behavior and Resilience

    The AI agent runs as a persistent process on your hardware, providing several advantages:

    • Hardware Independence: Runs outside the CVAT server, enabling tracking without server-side GPU/Nuclio installation
    • Isolation: Agent crashes don’t affect the server; requests are retried or reassigned automatically
    • Resource Control: You control the computational resources (CPU/GPU) used for tracking

    Version Requirements

    • AI Agent SAM2 Tracker: Requires CVAT version 2.42.0 or later
    • Classic SAM2 Tracker: Available in all Enterprise versions
    • Python: Version 3.10 or later for AI agent setup
    • GPU Support: Optional but recommended for both implementations

    Usage

    Both SAM2 tracker implementations provide similar user experiences with slight differences in the UI labels.

    Running the Nuclio SAM2 Tracker

    The nuclio tracker can be applied to any polygons and masks. To run the tracker on an object, open the object menu and click Run annotation action.

    Alternatively, you can use a hotkey: select the object and press Ctrl + E (default shortcut). When the modal opened, in “Select action” list, choose Segment Anything 2: Tracker:

    Running the AI Agent SAM2 Tracker

    Once you have registered the SAM2 AI agent and it’s running, you’ll see “AI Tracker: SAM2” as an available action in the annotation UI for video shape tracking.

    To use the AI agent tracker:

    1. Create or open a CVAT task from a video file or video-like sequence of images (all images must have the same dimensions)
    2. Open one of the jobs from the task
    3. Draw a mask or polygon around an object
    4. Right-click the object and choose “Run annotation action”
    5. Select “AI Tracker: SAM2” from the action list
    6. Specify the target frame and click Run

    The usage flow parallels the existing annotation action interface but utilizes the remote AI agent rather than built-in serverless functions.

    Tracking Process

    Specify the target frame until which you want the object to be tracked, then click the Run button to start tracking. The process begins and may take some time to complete. The duration depends on the inference device, and the number of frames where the object will be tracked.

    Once the process is complete, the modal window closes. You can review how the object was tracked. If you notice that the tracked shape deteriorates at some point, you can adjust the object coordinates and run the tracker again from that frame.

    Running on multiple objects

    Instead of tracking each object individually, you can track multiple objects simultaneously. To do this, click the Menu button in the annotation view and select the Run Actions option:

    Alternatively, you can use a hotkey: just press Ctrl + E (default shortcut) when there are no objects selected. This opens the actions modal. In this case, the tracker will be applied to all visible objects of suitable types (polygons and masks). In the action list of the opened modal, select either:

    • Segment Anything 2: Tracker (for the nuclio implementation)
    • AI Tracker: SAM2 (for the AI agent implementation)

    Specify the target frame until which you want the objects to be tracked, then click the Run button to start tracking. The process begins and may take some time to complete. The duration depends on the inference device, the number of simultaneously tracked objects, and the number of frames where the objects will be tracked.

    Once the process finishes, you may close the modal and review how the objects were tracked. If you notice that the tracked shapes deteriorate, you can adjust their coordinates and run the tracker again from that frame (for a single object or for many objects).

    Limitations and Considerations

    AI Agent Limitations

    When using the AI agent implementation, keep in mind:

    • Single Agent Constraint: Only one agent can run at a time for any given tracking function. Running multiple agents may cause random failures as they compete for tracking states.
    • Memory-based State: Tracking states are kept in agent memory. If the agent crashes or is shut down, all tracking states are lost and active tracking processes will fail.
    • Agent-only Usage: Tracking functions can only be used via agents. There is no equivalent of the cvat-cli task auto-annotate command for tracking.
    • Rectangle Limitation: When using the AI Tools dialog (sidebar), only tracking functions that support rectangles will be selectable. The SAM2 tracker supports polygons and masks but not rectangles.
    • Skeleton Tracking: Skeletons cannot currently be tracked by either implementation.

    Tracker parameters

    • Target frame: Objects will be tracked up to this frame. Must be greater than the current frame
    • Convert polygon shapes to tracks: When enabled, all visible polygon shapes in the current frame will be converted to tracks before tracking begins. Use this option if you need tracks as the final output but started with shapes, produced for example by interactors (e.g. SAM2 or another one).

    See Also