Skip to content

Commit aeabdd0

Browse files
Merge pull request #10397 from cvat-ai/release-2.61.0
Release v2.61.0
2 parents 697bb34 + 89fc9c3 commit aeabdd0

117 files changed

Lines changed: 1891 additions & 979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
<!-- scriv-insert-here -->
1818

19+
<a id='changelog-2.61.0'></a>
20+
## \[2.61.0\] - 2026-03-20
21+
22+
### Added
23+
24+
- "Snap to point" feature for polygon and polyline editing. While enabled,
25+
points being moved or drawn will automatically snap to nearby points from other shapes
26+
(<https://github.com/cvat-ai/cvat/pull/10353>)
27+
28+
- Join tool now supports polygon shapes, allowing to merge multiple
29+
polygons into a single unified polygon.
30+
(<https://github.com/cvat-ai/cvat/pull/10362>)
31+
32+
### Changed
33+
34+
- Minor visual improvements on the controls sidebar
35+
(<https://github.com/cvat-ai/cvat/pull/10374>)
36+
37+
### Fixed
38+
39+
- Helm modifiable permissionFix paths and command
40+
(<https://github.com/cvat-ai/cvat/pull/7932>)
41+
1942
<a id='changelog-2.60.0'></a>
2043
## \[2.60.0\] - 2026-03-17
2144

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Docker compose
22
CVAT_BASE_URL=https://app.cvat.ai # Your CVAT instance URL. Default is https://app.cvat.ai
3+
FUNCTION_NAME=your_function_name # Name of the function to create in CVAT.
34
CVAT_ACCESS_TOKEN=your_cvat_token # Required to authenticate to CVAT API. You can get it in CVAT UI: https://app.cvat.ai/profile#security
45
IMAGE_URL= your_repo:your_image_tag # Please specify your image url with tag. For example: myrepo/sam2:latest
56
AGENTS_COUNT=1 # SAM2 does not support multiple agents (yet?), so this value should be set to 1
67
ORG_SLUG="" # Please specify your org slug if you want agent to deployed for organization
78
USE_CUDA=false # Set to true if you want to use GPU. Please ensure that you use right docker image.
89

910
# Model config params for SAM2
10-
# Supported params are: model_id
11-
# For more model_ids refer to https://huggingface.co/models?search=facebook%2Fsam2
11+
# Supported params are: model_id=str:model_id
12+
# model_id - model_id from https://huggingface.co/models?search=facebook%2Fsam2
13+
# MODEL_CONFIG_PARAMS="-p model_id=str:facebook/sam2.1-hiera-tiny"
1214
MODEL_CONFIG_PARAMS="-p model_id=str:facebook/sam2.1-hiera-tiny"

ai-models/agents_deployment/sam2/check_env.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ resolve_cuda() {
5151
fi
5252
}
5353

54+
resolve_function_name() {
55+
if [ -z "$FUNCTION_NAME" ]; then
56+
echo "Warning: FUNCTION_NAME environment variable not found. Default is SAM2"
57+
FUNCTION_NAME="SAM2"
58+
else
59+
echo "Using FUNCTION_NAME: $FUNCTION_NAME"
60+
fi
61+
}
62+
5463
common_env() {
5564
validate_access_token
5665
resolve_base_url

ai-models/agents_deployment/sam2/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
CVAT_ACCESS_TOKEN:
1111
MODEL_CONFIG_PARAMS:
1212
ORG_SLUG:
13+
FUNCTION_NAME:
1314

1415
cvat-agent:
1516
image: ${IMAGE_URL}

ai-models/agents_deployment/sam2/function_registration.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ source "$(dirname "$0")/check_env.sh"
66

77
common_env
88
resolve_model_params
9+
resolve_function_name
910

10-
# Hardcoded for SAM2
11-
12-
FUNCTION_NAME="SAM2"
1311
FUNCTION_FILE_PATH="func.py"
1412

1513

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Docker compose template file.
2+
CVAT_BASE_URL=your_cvat_url # Your CVAT instance URL. Default is https://app.cvat.ai
3+
CVAT_ACCESS_TOKEN=your_cvat_access_token_here # Required to authenticate to CVAT API. You can get it in CVAT UI: https://app.cvat.ai/profile#security
4+
MODEL_ID=your_model_id # Model ID/name.
5+
IMAGE_URL= your_cvat_image_here # Image to use for the agent.
6+
AGENTS_COUNT=1 # Number of agents to deploy.
7+
ORG_SLUG=your_organization_slug_here # If you want to create agent for your organization.
8+
USE_CUDA=false # Set to true if you want to use GPU. Please ensure that you use right docker image.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# We are aiming at using some thin image so that we can install only the necessary dependencies for our agent. Python 3.14-slim is a good choice for that.
2+
FROM python:3.14-slim
3+
4+
# Install necessary tools, feel free to add more if needed.
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
curl \
7+
git \
8+
jq \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
# These args are used to be able to build both GPU and CPU only images. If USE_GPU is set to true, we will install the GPU version of PyTorch, otherwise we will install the CPU only version.
12+
# Note that GPU support is only available for amd64 architecture, so we will check the TARGETARCH arg as well.
13+
ARG USE_GPU=false
14+
ARG TARGETARCH
15+
16+
# We would like to be able to deploy our image to k8s as well with Helm so we need kubectl.
17+
ADD --chmod=+x https://dl.k8s.io/release/v1.34.0/bin/linux/${TARGETARCH}/kubectl /usr/local/bin/
18+
19+
# Running as non root is good for security.
20+
RUN groupadd --gid 1000 agent && \
21+
useradd --uid 1000 --gid 1000 --create-home agent
22+
23+
# Required to share data in compose.
24+
RUN mkdir /shared && chown agent:agent /shared
25+
26+
WORKDIR /app
27+
28+
# Replace this with your relative path to the requirements.txt file. This file should contain all the dependencies for your agent.
29+
COPY path_to_your_model/requirements.txt .
30+
31+
# Assuming that your model uses pytorch this condition is responsible for building CPU only or GPU images.
32+
RUN if [ "$USE_GPU" = "true" ] && [ "$TARGETARCH" = "amd64" ]; then \
33+
echo "Building GPU image" && pip install --no-cache-dir cvat-cli -r requirements.txt; \
34+
else \
35+
echo "Building CPU only image" && pip install --no-cache-dir cvat-cli -r requirements.txt --extra-index-url=https://download.pytorch.org/whl/cpu; \
36+
fi
37+
38+
# Replace this with your relative path to the model files.
39+
# Assuming that you are using same names for the scripts.
40+
COPY path_to_your_model/ .
41+
COPY --chmod=755 path_to_your_model/function_registration.sh .
42+
COPY --chmod=755 path_to_your_model/function_deregistration.sh .
43+
COPY --chmod=755 path_to_your_model/check_env.sh .
44+
COPY --chmod=755 path_to_your_model/entrypoint.sh .
45+
46+
USER agent
47+
48+
ENTRYPOINT ["./entrypoint.sh"]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This is an example Dockerfile template and docker compose for deploying your agent in CVAT.
2+
3+
4+
## The general Dockerfile approach is:
5+
6+
1. Select base image to use with your agent.
7+
2. Install necessary packages with a package manager.
8+
For example YOLO needs libxcb1, libgl1, libglib2.0-0
9+
3. Install cvat-cli, and if you need any Python dependencies, you may put them to requirements.txt
10+
4. You should have `func.py` file that acts as adapter between your agent and CVAT.
11+
You can refer to existing adapters for YOLO, SAM2 or transformers for inspiration. (`/ai-models/detector/yolo/func.py`,
12+
`/ai-models/tracker/sam2/func.py`, `/ai-models/transformers/func.py`)
13+
5. Consider supporting some build args like `$USE_GPU` to allow users to choose between CPU and GPU
14+
versions of the image.
15+
For the models that we've implemented as agents we rely on `pytorch` CPU or GPU wheels.
16+
6. Your image should implement the following functionality
17+
- Register function that will be powered by your agent in CVAT.
18+
- Run agent that will be polling CVAT for new tasks (Entrypoint).
19+
- Deregister function in CVAT when it is not needed anymore.
20+
21+
All three capabilities are powered by cvat-cli that authenticates in CVAT with provided API key and allows to
22+
register/deregister functions and run agents.
23+
Please refer to scripts [`entrypoint.sh`](./entrypoint.sh), [`function_registration.sh`](./function_registration.sh)
24+
and [`function_deregistration.sh`](./function_deregistration.sh) for examples of how to use cvat-cli to implement
25+
these capabilities.
26+
27+
### General recommendations
28+
- Run your container with a non-root user.
29+
- Use lightweight base images to reduce the size of your image and speed up deployment.
30+
- Keep the frequently changing layers of your Docker closer to the end of your Dockerfile to take advantage of caching.
31+
- Always pin the versions of your dependencies.
32+
33+
## Docker compose
34+
Once your image is built, use Docker Compose to manage the agent lifecycle.
35+
All services use the same image.
36+
37+
1. It runs function registration script in the container (`cvat-function-register` service).
38+
2. `cvat-function-register` service creates a file on shared volume.
39+
3. `cvat-agent` service runs agents that connect to CVAT function that was created in step 1.
40+
4. When agent is not needed user should run `cvat-function-deregister` service manually to delete function from CVAT.
41+
(docker compose run --rm cvat-function-deregister)
42+
43+
It's easy to configure docker compose using [`.env`](./.env) file that should be located in the same folder as `docker-compose.yaml`
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# This file contains functions that are used to validate existence of important variables
4+
# and setting defaults in some cases.
5+
6+
validate_access_token() {
7+
if [ -z "$CVAT_ACCESS_TOKEN" ]; then
8+
echo "Error: CVAT_ACCESS_TOKEN environment variable must be set."
9+
exit 1
10+
fi
11+
}
12+
13+
resolve_base_url() {
14+
if [ -z "$CVAT_BASE_URL" ]; then
15+
echo "Warning: CVAT_BASE_URL environment variable is missing, using https://app.cvat.ai as default."
16+
CVAT_BASE_URL="https://app.cvat.ai"
17+
fi
18+
}
19+
20+
resolve_org_slug() {
21+
ORG_SLUG_ARGS=()
22+
if [ -z "$ORG_SLUG" ]; then
23+
echo "Warning: ORG_SLUG environment variable not found. Function will be registered only for your user."
24+
echo "ORG_SLUG must be the short name of the organization; it is the name displayed under your username when you switch to the organization in the CVAT UI."
25+
ORG_CURL_ARGS=(--data-urlencode "org=")
26+
else
27+
echo "Using organization: $ORG_SLUG"
28+
ORG_SLUG_ARGS=(--organization "$ORG_SLUG")
29+
ORG_CURL_ARGS=(--data-urlencode "org=$ORG_SLUG")
30+
fi
31+
}
32+
33+
# This example is for SAM2 function.
34+
# For your function it will be different.
35+
resolve_model_id() {
36+
if [ -z "$MODEL_ID" ]; then
37+
echo "Warning: MODEL_ID environment variable not found. Default is facebook/sam2.1-hiera-tiny"
38+
MODEL_ID="facebook/sam2.1-hiera-tiny"
39+
else
40+
echo "Using MODEL_ID: $MODEL_ID"
41+
fi
42+
}
43+
44+
resolve_cuda() {
45+
if [ "$USE_CUDA" = "true" ]; then
46+
echo "Using CUDA! Please ensure that you are using proper image with CUDA support"
47+
USE_CUDA_ARGS=(-p device=str:cuda)
48+
else
49+
echo "Info: USE_CUDA environment variable not found. Model will run on CPU."
50+
fi
51+
}
52+
53+
common_env() {
54+
validate_access_token
55+
resolve_base_url
56+
resolve_org_slug
57+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
services:
2+
cvat-function-register:
3+
image: ${IMAGE_URL}
4+
entrypoint: ["/app/function_registration.sh"]
5+
volumes:
6+
- shared-data:/shared
7+
restart: "on-failure"
8+
environment:
9+
CVAT_BASE_URL:
10+
CVAT_ACCESS_TOKEN:
11+
MODEL_ID:
12+
ORG_SLUG:
13+
14+
cvat-agent:
15+
image: ${IMAGE_URL}
16+
volumes:
17+
- shared-data:/shared:ro
18+
depends_on:
19+
cvat-function-register:
20+
condition: service_completed_successfully
21+
deploy:
22+
replicas: ${AGENTS_COUNT:-1}
23+
environment:
24+
CVAT_BASE_URL:
25+
CVAT_ACCESS_TOKEN:
26+
MODEL_ID:
27+
ORG_SLUG:
28+
29+
#NB! MANUAL RUN!
30+
# docker compose run --rm cvat-function-deregister
31+
# This command will run this service once and remove container after execution.
32+
cvat-function-deregister:
33+
image: ${IMAGE_URL}
34+
entrypoint: ["/app/function_deregistration.sh"]
35+
volumes:
36+
- shared-data:/shared:ro
37+
profiles:
38+
- manual
39+
environment:
40+
CVAT_BASE_URL:
41+
CVAT_ACCESS_TOKEN:
42+
ORG_SLUG:
43+
44+
volumes:
45+
shared-data:

0 commit comments

Comments
 (0)