Running CVAT

To run CVAT locally, clone the repository:

git clone https://github.com/opencv/cvat.git && cd cvat

Before running CVAT services, you need to modify the docker-compose.yml file to enable communication between HUMAN Protocol and CVAT containers.

First add a network alias for the traefik service by changing its networks section to:

networks:
  cvat:
    aliases:
      - cvat-lb

Then configure the cvat network at the bottom of the compose file:

networks:
  cvat:
    name: human-cvat-bridge
    external: true

To allow HUMAN Protocol services to communicate with CVAT services, retrieve the bridge network subnet CIDR:

docker network inspect human-cvat-bridge | grep Subnet | awk -F'"' '{print $4}'
# 172.19.0.0/16

When starting CVAT, specify --allow-range using that CIDR and cvat-lb as the host:

SMOKESCREEN_OPTS="--allow-range=172.19.0.0/16" \
    CVAT_HOST=cvat-lb \
    docker compose -f docker-compose.yml -f docker-compose.dev.yml \
    up -d

Info

If you need to update your cloned CVAT code, commit your changes and run git pull --rebase origin develop. Afterward, rebuild the containers by adding the --build flag to the above command.

CVAT will be available at http://cvat-lb:8080, so add a mapping to your /etc/hosts for convenience, because it will allow requests only with the Host: cvat-lb header.

If you use the localhost setup, you will likely need to create a bridge Docker network to access CVAT services from your local host:

docker network create \
    -o "com.docker.network.bridge.enable_icc=true" \
    -o "com.docker.network.bridge.enable_ip_masquerade=true" \
    -o "com.docker.network.driver.mtu=1500" \
    human-cvat-bridge

Then configure the cvat network at the bottom of the compose file:

networks:
  cvat:
    name: human-cvat-bridge
    external: true

To allow HUMAN Protocol services to communicate with CVAT services, retrieve the bridge network Gateway IP (traffic from your local host goes through this Gateway to containers):

docker network inspect human-cvat-bridge | grep Gateway
# 172.19.0.1

When starting CVAT, specify --allow-address using that IP:

SMOKESCREEN_OPTS="--allow-address=172.19.0.1/" \
    docker compose -f docker-compose.yml -f docker-compose.dev.yml \
    up -d

CVAT will be available at http://localhost:8080 and will allow requests only with the Host: localhost header.


Once you start CVAT, trigger a health check to verify that it works as expected:

docker exec -t cvat_server python manage.py health_check

Next, create a superuser to manage the CVAT instance:

docker exec -it cvat_server bash -ic 'python3 ~/manage.py createsuperuser'

Then go to the CVAT UI (http://cvat-lb:8080/ or http://localhost:8080, depending on your setup) in your browser, log in as superuser, and create a user for HUMAN Protocol services. Then log in as this user and create the organization for HUMAN Protocol.

Warning

When creating the organization and its admin user in CVAT, it's recommended to use the values defined for docker-setup in the human-protocol monorepo:

  • CVAT_ADMIN for the username
  • CVAT_ADMIN_PASS for the password
  • CVAT_ORG_SLUG for the organization short name