Skip to content

Commit eb9fba3

Browse files
author
Nikita Manovich
committed
Release 0.1.0
0 parents  commit eb9fba3

File tree

235 files changed

+51001
-0
lines changed

Some content is hidden

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

235 files changed

+51001
-0
lines changed

.dockerignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.git
2+
/share
3+
/data
4+
/media
5+
/.env
6+
/.vscode
7+
/db.sqlite3
8+
/keys

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Project Specific
2+
/data/
3+
/share/
4+
/static/
5+
/db.sqlite3
6+
/.env
7+
/keys
8+
/logs
9+
10+
# Ignore temporary files
11+
docker-compose.override.yml
12+
/.vscode
13+
__pycache__
14+
*.pyc
15+
._*

CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# How to contribute to Computer Vision Annotation Tool (CVAT)
2+
3+
When contributing to this repository, please first discuss the change you wish to make via issue,
4+
email, or any other method with the owners of this repository before making a change.

Dockerfile

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
FROM ubuntu:16.04
2+
3+
ARG http_proxy
4+
ARG https_proxy
5+
ARG no_proxy
6+
7+
ENV TERM=xterm \
8+
http_proxy=${http_proxy} \
9+
https_proxy=${https_proxy} \
10+
no_proxy=${no_proxy}
11+
12+
ENV LANG='C.UTF-8' \
13+
LC_ALL='C.UTF-8'
14+
15+
ARG USER
16+
ARG TF_ANNOTATION
17+
ENV TF_ANNOTATION=${TF_ANNOTATION}
18+
ARG DJANGO_CONFIGURATION
19+
ENV DJANGO_CONFIGURATION=${DJANGO_CONFIGURATION}
20+
21+
# Install necessary apt packages
22+
RUN apt-get update && \
23+
apt-get install -yq \
24+
python-software-properties \
25+
software-properties-common \
26+
wget && \
27+
add-apt-repository ppa:mc3man/xerus-media -y && \
28+
add-apt-repository ppa:mc3man/gstffmpeg-keep -y && \
29+
apt-get update && \
30+
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
31+
apache2 \
32+
apache2-dev \
33+
libapache2-mod-xsendfile \
34+
supervisor \
35+
ffmpeg \
36+
gstreamer0.10-ffmpeg \
37+
libldap2-dev \
38+
libsasl2-dev \
39+
python3-dev \
40+
python3-pip \
41+
unzip \
42+
unrar \
43+
p7zip-full \
44+
vim && \
45+
rm -rf /var/lib/apt/lists/*
46+
47+
# Add a non-root user
48+
ENV USER=${USER}
49+
ENV HOME /home/${USER}
50+
WORKDIR ${HOME}
51+
RUN adduser --shell /bin/bash --disabled-password --gecos "" ${USER}
52+
53+
# Install tf annotation if need
54+
COPY cvat/apps/tf_annotation/docker_setup_tf_annotation.sh /tmp/tf_annotation/
55+
COPY cvat/apps/tf_annotation/requirements.txt /tmp/tf_annotation/
56+
ENV TF_ANNOTATION_MODEL_PATH=${HOME}/rcnn/frozen_inference_graph.pb
57+
58+
RUN if [ "$TF_ANNOTATION" = "yes" ]; then \
59+
/tmp/tf_annotation/docker_setup_tf_annotation.sh; \
60+
fi
61+
62+
ARG WITH_TESTS
63+
RUN if [ "$WITH_TESTS" = "yes" ]; then \
64+
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
65+
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list && \
66+
wget -qO- https://deb.nodesource.com/setup_9.x | bash - && \
67+
apt-get update && \
68+
DEBIAN_FRONTEND=noninteractive apt-get install -yq \
69+
google-chrome-stable \
70+
nodejs && \
71+
rm -rf /var/lib/apt/lists/*; \
72+
mkdir tests && cd tests && npm install \
73+
eslint \
74+
eslint-detailed-reporter \
75+
karma \
76+
karma-chrome-launcher \
77+
karma-coverage \
78+
karma-junit-reporter \
79+
karma-qunit \
80+
qunit; \
81+
echo "export PATH=~/tests/node_modules/.bin:${PATH}" >> ~/.bashrc; \
82+
fi
83+
84+
# Install and initialize CVAT, copy all necessary files
85+
COPY cvat/requirements/ /tmp/requirements/
86+
COPY supervisord.conf mod_wsgi.conf wait-for-it.sh manage.py ${HOME}/
87+
RUN pip3 install --no-cache-dir -r /tmp/requirements/${DJANGO_CONFIGURATION}.txt
88+
COPY cvat/ ${HOME}/cvat
89+
COPY tests ${HOME}/tests
90+
RUN chown -R ${USER}:${USER} .
91+
92+
# RUN all commands below as 'django' user
93+
USER ${USER}
94+
95+
RUN mkdir data share media keys logs /tmp/supervisord
96+
RUN python3 manage.py collectstatic
97+
98+
EXPOSE 8080 8443
99+
ENTRYPOINT ["/usr/bin/supervisord"]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 annotation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Computer Vision Annotation Tool (CVAT)
2+
3+
CVAT is completely re-designed and re-implemented version of [Video Annotation Tool from Irvine, California](http://carlvondrick.com/vatic/) tool. It is free, online, interactive video and image annotation tool for computer vision. It is being used by our team to annotate million of objects with different properties. Many UI and UX decisions are based on feedbacks from professional data annotation team.
4+
5+
## LICENSE
6+
7+
Code released under the [MIT License](https://opensource.org/licenses/MIT).
8+
9+
## INSTALLATION
10+
11+
These instructions below should work for Ubuntu 16.04. Probably it will work on other OSes as well with minor modifications.
12+
13+
### Install [Docker CE](https://www.docker.com/community-edition) or [Docker EE](https://www.docker.com/enterprise-edition) from official site
14+
15+
Please read official manual [here](https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/).
16+
17+
### Install the latest driver for your graphics card
18+
19+
The step is necessary only to run tf_annotation app. If you don't have a Nvidia GPU you can skip the step.
20+
21+
```bash
22+
sudo add-apt-repository ppa:graphics-drivers/ppa
23+
sudo apt-get update
24+
sudo apt-cache search nvidia-* # find latest nvidia driver
25+
sudo apt-get install nvidia-* # install the nvidia driver
26+
sudo apt-get install mesa-common-dev
27+
sudo apt-get install freeglut3-dev
28+
sudo apt-get install nvidia-modprobe
29+
```
30+
31+
Reboot your PC and verify installation by `nvidia-smi` command.
32+
33+
### Install [Nvidia-Docker](https://github.com/NVIDIA/nvidia-docker)
34+
35+
The step is necessary only to run tf_annotation app. If you don't have a Nvidia GPU you can skip the step. See detailed installation instructions on repository page.
36+
37+
### Install docker-compose (1.19.0 or newer)
38+
39+
```bash
40+
sudo pip install docker-compose
41+
```
42+
43+
### Build docker images
44+
45+
To build all necessary docker images run `docker-compose build` command. By default, in production mode the tool uses PostgreSQL as database, Redis for caching.
46+
47+
### Run containers without tf_annotation app
48+
49+
To start all containers run `docker-compose up -d` command. Go to [localhost:8080](http://localhost:8080/). You should see a login page.
50+
51+
### Run containers with tf_annotation app
52+
53+
If you would like to enable tf_annotation app first of all be sure that nvidia-driver, nvidia-docker and docker-compose>=1.19.0 are installed properly (see instructions above) and `docker info | grep 'Runtimes'` output contains `nvidia`.
54+
55+
Run following command:
56+
```bash
57+
docker-compose -f docker-compose.yml -f docker-compose.nvidia.yml up -d --build
58+
```
59+
60+
### Create superuser account
61+
62+
You can [register a user](http://localhost:8080/auth/register) but by default it will not have rights even to view list of tasks. Thus you should create a superuser. The superuser can use admin panel to assign correct groups to the user. Please use the command below:
63+
64+
```bash
65+
docker exec -it cvat sh -c '/usr/bin/python3 ~/manage.py createsuperuser'
66+
```
67+
68+
Type your login/password for the superuser [on the login page](http://localhost:8080/auth/login) and press **Login** button. Now you should be able to create a new annotation task. Please read documentation for more details.
69+
70+
### Stop all containers
71+
72+
The command below will stop and remove containers, networks, volumes, and images
73+
created by `up`.
74+
75+
```bash
76+
docker-compose down
77+
```
78+
79+
### Advanced settings
80+
81+
If you want to access you instance of CVAT outside of your localhost you should specify [ALLOWED_HOSTS](https://docs.djangoproject.com/en/2.0/ref/settings/#allowed-hosts) environment variable. The best way to do that is to create [docker-compose.override.yml](https://docs.docker.com/compose/extends/) and put all your extra settings here.
82+
83+
```yml
84+
version: "2.3"
85+
86+
services:
87+
cvat:
88+
environment:
89+
ALLOWED_HOSTS: .example.com
90+
ports:
91+
- "80:8080"
92+
```
93+
### Annotation logs
94+
95+
It is possible to proxy annotation logs from client to another server over http. For examlpe you can use Logstash.
96+
To do that set DJANGO_LOG_SERVER_URL environment variable in cvat section of docker-compose.yml
97+
file (or add this variable to docker-compose.override.yml).
98+
99+
```yml
100+
version: "2.3"
101+
102+
services:
103+
cvat:
104+
environment:
105+
DJANGO_LOG_SERVER_URL: https://annotation.example.com:5000
106+
```

cvat/__init__.py

Whitespace-only changes.

cvat/apps/authentication/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
default_app_config = 'cvat.apps.authentication.apps.AuthenticationConfig'

cvat/apps/authentication/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

cvat/apps/authentication/apps.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from django.apps import AppConfig
2+
from django.db.models.signals import post_migrate, post_save
3+
from .settings.authentication import DJANGO_AUTH_TYPE
4+
5+
class AuthenticationConfig(AppConfig):
6+
name = 'cvat.apps.authentication'
7+
8+
def ready(self):
9+
from . import signals
10+
from django.contrib.auth.models import User
11+
12+
post_migrate.connect(signals.create_groups)
13+
14+
if DJANGO_AUTH_TYPE == 'SIMPLE':
15+
post_save.connect(signals.create_user, sender=User, dispatch_uid="create_user")
16+
17+
import django_auth_ldap.backend
18+
django_auth_ldap.backend.populate_user.connect(signals.update_ldap_groups)
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from django.contrib.auth import REDIRECT_FIELD_NAME
2+
from django.shortcuts import resolve_url, reverse
3+
from django.http import JsonResponse
4+
from urllib.parse import urlparse
5+
from django.contrib.auth.views import redirect_to_login
6+
7+
from functools import wraps
8+
from django.conf import settings
9+
10+
def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None, redirect_methods=['GET']):
11+
def decorator(view_func):
12+
@wraps(view_func)
13+
def _wrapped_view(request, *args, **kwargs):
14+
if request.user.is_authenticated:
15+
return view_func(request, *args, **kwargs)
16+
else:
17+
if request.method not in redirect_methods:
18+
return JsonResponse({'login_page_url': reverse('login')}, status=403)
19+
20+
path = request.build_absolute_uri()
21+
resolved_login_url = resolve_url(login_url or settings.LOGIN_URL)
22+
# If the login url is the same scheme and net location then just
23+
# use the path as the "next" url.
24+
login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
25+
current_scheme, current_netloc = urlparse(path)[:2]
26+
if ((not login_scheme or login_scheme == current_scheme) and
27+
(not login_netloc or login_netloc == current_netloc)):
28+
path = request.get_full_path()
29+
30+
return redirect_to_login(path, resolved_login_url, redirect_field_name)
31+
return _wrapped_view
32+
return decorator(function) if function else decorator

cvat/apps/authentication/forms.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
from django.contrib.auth.forms import (
2+
UsernameField,
3+
AuthenticationForm,
4+
UserCreationForm,
5+
)
6+
from django.utils.translation import gettext, gettext_lazy as _
7+
from django.contrib.auth.models import User
8+
9+
from django import forms
10+
11+
class AuthForm(AuthenticationForm):
12+
username = UsernameField(
13+
widget=forms.TextInput(attrs={'autofocus': True, 'placeholder': "Username"}),
14+
)
15+
password = forms.CharField(
16+
label=_("Password"),
17+
strip=False,
18+
widget=forms.PasswordInput(attrs={'placeholder': "Password"}),
19+
)
20+
21+
class NewUserForm(UserCreationForm):
22+
username = UsernameField(
23+
widget=forms.TextInput(attrs={'autofocus': True, 'placeholder': "Username (required)"}),
24+
required=True,
25+
)
26+
27+
first_name = UsernameField(
28+
widget=forms.TextInput(attrs={'placeholder': "First name"}),
29+
required=False,
30+
)
31+
32+
last_name = UsernameField(
33+
widget=forms.TextInput(attrs={'placeholder': "Last name"}),
34+
required=False,
35+
)
36+
37+
email = forms.EmailField(
38+
widget=forms.EmailInput(attrs={'placeholder': "Email (required)"}),
39+
required=True,
40+
)
41+
42+
password1 = forms.CharField(
43+
label=_("Password"),
44+
strip=False,
45+
widget=forms.PasswordInput(attrs={'placeholder': "Password (required)"}),
46+
)
47+
password2 = forms.CharField(
48+
label=_("Password confirmation"),
49+
widget=forms.PasswordInput(attrs={'placeholder': "Password confirmation (required)"}),
50+
strip=False,
51+
)
52+
53+
class Meta:
54+
model = User
55+
fields = ('username', 'first_name', 'last_name', 'email', )

cvat/apps/authentication/migrations/__init__.py

Whitespace-only changes.

cvat/apps/authentication/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

cvat/apps/authentication/settings/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)