Detailed tutorial on CVAT installation and picture annotation [including stepping on the pit record]

      cvat is an image annotation tool, record the installation and use process:

Table of contents

1. CVAT installation

step1 install docker

step2 Get permission

step3 Get permission

step4 clone cvat source code

step5 build docker image

step6 run Docker container This step needs to download the public docker image, it will take time depending on the network speed, but it will not be too long.

step6 Create an administrator user

step7 Close the cvat service

2. CVAT installation and picture annotation tutorial

1. Registration

2. Basic labeling

2.1 Create Task

2.2 Task list page

2.3 Task inner page

2.4 Annotate pages

2.5 Labeling Tips

3. Download the annotation result


 Mainly draw on the following articles:

[Common tools] cvat installation instructions

Instructions for use of CVAT

A little summary of the use of CVAT

1. CVAT installation

step1 install docker

        Cvat runs under docker, and docker must be installed first.

sudo apt-get update
sudo apt-get --no-install-recommends install -y \
  apt-transport-https \
  ca-certificates \
  curl \
  gnupg-agent \
  software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
sudo apt-get update
sudo apt-get --no-install-recommends install -y docker-ce docker-ce-cli containerd.io


step2 Get permission

        To run docker without root permission, you need to obtain permission. After obtaining the permission, you must restart the system .

sudo groupadd docker
sudo usermod -aG docker $USER


step3 Get permission

        Install docker-compose (1.19.0 or later). Compose is a tool for defining and running multi-container Docker applications.

sudo apt-get --no-install-recommends install -y python3-pip python3-setuptools
sudo python3 -m pip install setuptools docker-compose

Errors may occur in this step:

aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Kylin/kylin

This is because the file information of the system /etc/lsb-release has been changed after installing the Ubuntu Kylin software. Enter the command:

 sudo gedit /etc/lsb-release

The found file looks like this:

Change to: 

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

Re-execute step3 to obtain permissions, there should be no problem.


step4 clone cvat source code

        The official github repository is very slow, so I used the gitee mirror.

sudo apt-get --no-install-recommends install -y git
git clone https://gitee.com/luohenyueji/cvat
cd cvat


step5 build docker image

        This step is the most difficult and time-consuming step. It will download a lot of things including a bunch of python libraries, so wait slowly. It is recommended to use a mirror for python library installation. Specifically, open the source code directory cvat/Dockerfile downloaded in the previous step, and find the Install requirements item. Then modify and add the corresponding python image. I use the Alibaba Cloud image, but it can be replaced with another one.

#RUN DATUMARO_HEADLESS=1 python3 -m pip install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
RUN DATUMARO_HEADLESS=1 python3 -m pip install -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt -i https://mirrors.aliyun.com/pypi/simple/


        Then enter the following command in the cvat directory and wait slowly. If the installation fails midway, just enter the command again. Note that sudo should be used.

sudo docker-compose build


step6 Run the Docker container
This step is to download the public docker image, which takes time depending on the network speed, but it will not take too long.

docker-compose up -d


After this step, you can open your cvat website, but you need to use Google Chrome. If you have installed Google Chrome, you don’t need to worry about it. There is no installation method for ubuntu18.10 to install Chrome browser.

At this time, Google Chrome opens localhost:8080 and you can see the cvat page, as shown below


Click create an account to create a common user, but it is best to create an administrator account for the first time, see the next step for details.

step6 Create an administrator user

Enter the following command, and then you will be prompted to create an administrator account password.

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


step7 Close the cvat service

After running step6, even if the server is restarted, the cvat service will continue to run. To close enter the following command in the cvat directory:

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


To restart, repeat step6.

2. CVAT installation and picture annotation tutorial

1. Registration

  • Registration is required when using CVAT for the first time,
  • After the user is registered, he can create a labeling task

2. Basic labeling

2.1 Create Task

  • After logging in, you will see the following interface. The smallest unit of CVAT labeling is Task, and each Task is a labeling task. Click the Task button to see the created tasks, and click to create a new task.
  • The page for creating a new task is as follows. Follow the steps identified below. The first step is to fill in the task name, the name of the project to be associated (optional), the second step is to set the label, the third step is to select the label data source, and the fourth step is to select advanced settings parameters, the fifth step is to submit.
  • Label label detailed explanation
    • There are two modes for adding labels: Raw and Constructor. Constructor can add and adjust label settings one by one, and set the new label name, color, attributes, etc. If you want to use the filtering function, you can add the "selected" tag here, and then you can filter the labeled data based on this tag.
    • Raw is a file in json format that can be copied with one click. This function can easily set multiple labels when the corresponding labels of multiple tasks are the same. The content of the Raw example is shown in the figure below. The json content can be copied through the Copy button for the new task label setting. After pasting, click Done to save the current setting, and Reset to maintain the original setting. For example, if the color of a label in the new task is changed, after the change If the new settings are found to be inappropriate, Reset can restore the original settings with one click.
  • Advanced Configuration Many parameters of Advanced configuration are not used at this stage. The following are only a few commonly used parameters:

    • Use zip chunks: for video data, compressed into zip format
    • Use cache: data cache
    • Image quality: It is used to specify the quality of the uploaded image. When the high-resolution image is uploaded too slowly, the resolution can be reduced to increase the speed. However, if you choose to read data from the server in the previous step, the image reading speed will be greatly improved.
    • Overlap size: When the current data is divided into N jobs for labeling, the number of frames repeated between each job;
    • Segment size: Divide the current data into N jobs. N is the value here. It is mainly used for scenes where there are too many pictures and multiple people need to mark them together. Each person marks a Job and uses this parameter to divide the data into blocks;
    • Start frame: The collected video data may not need to be marked completely. For example, the target frame may only be the 20th-100th frame. This parameter is used to set the starting frame;
    • Stop frame: Corresponding to the Start frame, this is the end frame position;
    • Frame step: It may not be necessary to mark every frame, for example, mark every M frame, and M is the value here;
    • Other parameters are not needed for now, please refer to the official documentation for details.

2.2 Task list page

  • The created Task looks like this
    • Expand in Actions:
      • Upload annotations: Supports label import. For example, on the premise of the existing head and human body labels in the Crowdhuman public data set, if you want to continue to label the vehicles in this data set for the training set of three types of targets: heads, pedestrians, and cars, you can use this The function imports the head and body tags, and only uses CVAT to mark the vehicle tags. For specific operations, please refer to Chapter 5 "Tag Import" of this tutorial.
      • Export task dataset: Download the dataset labels to the local.
      • Automatic annotation: Semi-automatic labeling, CVAT supports online generation of labels for datasets with pre-trained models, which can greatly improve the efficiency of labeling, see Chapter 6 "Semi-automatic labeling" for details.
      • Export task: Support importing or exporting an existing task, see here for details .
      • Move to project: As the name implies, when this task is moved to another project, the label attribute changes and label mismatch problems that occur during the move need to be modified accordingly.
      • Delete: Delete this task.

2.3 Task inner page

  • The inner page of the task is shown in the figure below. In the inner page of the task, some basic information of the task can be modified, and tasks can also be assigned. described as follows:
      1. Task name, can be modified
      2. This Actions is the same as the Actions description in Section 2.2
      3. Issue Tracker, generally not used, temporarily ignored
      4. Label settings, modifiable
      5. Assign this Task to a member
      6. Assign this job to a member for labeling
      7. Determine the quality inspector, who will inspect the quality of the marked data

2.4 Annotate pages

  • Click the corresponding Job to enter the annotation interface. The interface is divided into 5 parts, as shown in the figure below:
    • Header: It mainly includes navigation of several basic functions of CVAT, as well as related settings of the current user. The basic functions include Project\Tasks\Cloud Storages\Models, respectively representing labeling projects, labeling tasks, cloud storage, and pre-trained models.
    • Top panel: Mainly includes image navigation (select image), Menu, save, undo/restore, full screen, annotation result statistics, mode switching.
    • Workspace: Workspace, the area where the image is located.
    • Controls sidebar: Control the sidebar of related commands, including setting the size and position of pictures, creating shapes, editing tracks and other basic annotation functions.
    • Object sidebar: label-related sidebar, including two options (objects and labels), as well as appearance-related settings (that is, the display color, transparency, etc. of various labels).

  • Navigation related
    • CVAT provides functions such as selecting the previous frame, the next frame, jumping to the next (previous) frame in units of steps, playing each frame sequentially, jumping to the beginning, and the end frame.
    • After the frame is selected, there are several basic operations to select the position and zoom of the image:
      • Move Image/Choose Center Position: Use the options from the first image.
      • The other two functions are: fit the image to the screen size/select an area to enlarge.

2.5 Labeling Tips

  • The shortcut keys in the labeling process can save a lot of effort. The following are some of the more commonly used ones. For more information, please refer to the official documentation here :
    • Save: Ctrl + S
    • Delete: Delete
    • Zoom: Mouse scroll, zoom up, zoom out
    • Drag: Click and drag the picture with the left mouse button to adjust the position
    • next frame: F
    • Last frame: D
    • Jump back ten sheets: Shift+Ctrl+V
    • Jump forward ten sheets: Shift+Ctrl+C
    • Copy box: Ctrl + C
    • Paste box: Ctrl + V
    • Repeat the last labeling frame parameter: N, such as marking a class of header boxes continuously, then press N each time you repeat the labeling to directly mark a header box
    • Continuously label the selected object in all subsequent frames: Ctrl + B
    • Convert label: Ctrl+(0..9)

3. Download the annotation result

Guess you like

Origin blog.csdn.net/ZHUO__zhuo/article/details/125068660