Skip to content

Commit

Permalink
Release 0.1.2
Browse files Browse the repository at this point in the history
* Fixed 7z support. (#235)
* Added 'Development Environment' into CONTRIBUTING.md
* More strict verification for labels with attributes.
* More strict check for values of checkbox/number type of attributes.
* Added .vscode/launch.json

Changes:
- Fixed #14 (docker-compose down command as written in the readme does not remove volumes)
- Fixed #15 (All checkboxes in temporary attributes are checked when reopening job after saving the job)
- Fixed #18 (Extend contributing.md)
- Fixed #19 (Using the same attribute for label twice -> Stuck)
  • Loading branch information
Nikita Manovich committed Aug 7, 2018
1 parent e8b2c40 commit dea2724
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 16 deletions.
97 changes: 97 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "CVAT Server",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading",
"--insecure",
"127.0.0.1:7000"
],
"debugOptions": [
"RedirectOutput",
"DjangoDebugging"
],
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
},
{
"name": "CVAT Client",
"type": "chrome",
"request": "launch",
"url": "http://localhost:7000/",
"disableNetworkCache":true,
"trace": true,
"showAsyncStacks": true,
"pathMapping":{
"/static/engine/": "${workspaceFolder}/cvat/apps/engine/static/engine/",
"/static/dashboard/": "${workspaceFolder}/cvat/apps/dashboard/static/dashboard/",
}
},
{
"name": "CVAT RQ - default",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"rqworker",
"default",
"--worker-class",
"cvat.simpleworker.SimpleWorker",
],
"debugOptions": [
"RedirectOutput",
"DjangoDebugging"
],
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",

},
{
"name": "CVAT RQ - low",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${workspaceRoot}/manage.py",
"args": [
"rqworker",
"low",
"--worker-class",
"cvat.simpleworker.SimpleWorker",
],
"debugOptions": [
"RedirectOutput",
"DjangoDebugging"
],
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
},
],
"compounds": [
{
"name": "CVAT Debugging",
"configurations": [
"CVAT Client",
"CVAT Server",
"CVAT RQ - default",
"CVAT RQ - low",
]
}
]
}
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,52 @@

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

## Development environment

Next steps should work on clear Ubuntu 18.04.

- Install necessary dependencies:

```sh
$ sudo apt-get install -y curl redis-server python3-dev python3-pip python3-venv libldap2-dev libsasl2-dev
```

- Install [Visual Studio Code](https://code.visualstudio.com/docs/setup/linux#_debian-and-ubuntu-based-distributions) for development

- Install CVAT on your local host:

```sh
$ git clone https://github.com/opencv/cvat
$ cd cvat && mkdir logs keys
$ python3 -m venv .env
$ . .env/bin/activate
$ pip install -U pip wheel
$ pip install -r cvat/requirements/development.txt
$ python manage.py migrate
$ python manage.py collectstatic
```

- Create a super user for CVAT:

```sh
$ python manage.py createsuperuser
Username (leave blank to use 'django'): ***
Email address: ***
Password: ***
Password (again): ***
```

- Run Visual Studio Code from the virtual environment

```
$ code .
```

- Inside Visual Studio Code install [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome) and [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) extensions

- Reload Visual Studio Code

- Select `CVAT Debugging` configuration and start debugging (F5)

You have done! Now it is possible to insert breakpoints and debug server and client of the tool.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ Type your login/password for the superuser [on the login page](http://localhost:

### Stop all containers

The command below will stop and remove containers, networks, volumes, and images
created by `up`.
The command below will stop and remove containers and networks created by `up`. See documentation for [docker-compose down](https://docs.docker.com/compose/reference/down/) for more details.

```bash
docker-compose down
Expand Down
24 changes: 24 additions & 0 deletions cvat/apps/engine/media.mimetypes
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,27 @@ image/x-kde-raw mos
image/x-dds dds
image/x-quicktime qif

# possible archive mimetypes (limited set)
application/gzip gz
application/rar rar
application/x-7z-compressed 7z
application/x-bzip bz bz2
application/x-bzip-compressed-tar tar.bz tar.bz2 tb2 tbz tbz2
application/x-compress z
application/x-compressed-tar tar.gz tgz
application/x-cpio cpio
application/x-gtar-compressed tgz taz
application/x-lha lzh
application/x-lhz lhz
application/x-lrzip-compressed-tar tar.lrz tlrz
application/x-lz4 lz4
application/x-lzip lz
application/x-lzip-compressed-tar tar.lz
application/x-lzma lzma
application/x-lzma-compressed-tar tar.lzma tlz
application/x-lzop lzo
application/x-tar gtar tar
application/x-tarz tar.z
application/x-tzo tar.lzo
application/x-xz-compressed-tar txz
application/zip zip
52 changes: 38 additions & 14 deletions cvat/apps/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ def _parse_labels(labels):
last_label = ""
for token in shlex.split(labels):
if token[0] != "~" and token[0] != "@":
if token in parsed_labels:
raise ValueError("labels string is not corect. " +
"`{}` label is specified at least twice.".format(token))

parsed_labels[token] = {}
last_label = token
else:
Expand All @@ -306,7 +310,29 @@ def _parse_labels(labels):
atype = match.group(2)
aname = match.group(3)
values = list(csv.reader(StringIO(match.group(4)), quotechar="'"))[0]
parsed_labels[last_label][aname] = {'prefix':prefix, 'type':atype, 'values':values}
attr = {'prefix':prefix, 'name':aname, 'type':atype, 'values':values, 'text':token}

if not attr['type'] in ['checkbox', 'radio', 'number', 'text', 'select']:
raise ValueError("labels string is not corect. " +
"`{}` attribute has incorrect type {}.".format(
attr['name'], attr['type']))

if attr['name'] in parsed_labels[last_label]:
raise ValueError("labels string is not corect. " +
"`{}` attribute is specified at least twice.".format(attr['name']))

if attr['type'] == 'checkbox': # <prefix>checkbox=name:true/false
if not (len(values) == 1 and values[0] in ['true', 'false']):
raise ValueError("labels string is not corect. " +
"`{}` attribute has incorrect value.".format(attr['name']))
elif attr['type'] == 'number': # <prefix>number=name:min,max,step
if not (len(values) == 3 and values[0].isdigit() and \
values[1].isdigit() and values[2].isdigit() and \
int(values[0]) < int(values[1])):
raise ValueError("labels string is not corect. " +
"`{}` attribute has incorrect format.".format(attr['name']))

parsed_labels[last_label][attr['name']] = attr

return parsed_labels

Expand Down Expand Up @@ -437,22 +463,20 @@ def _create_thread(tid, params):
db_job.segment = db_segment
db_job.save()

labels = params['labels']
global_logger.info("labels with attributes for task #{} is {}".format(db_task.id, labels))
db_label = None
for token in shlex.split(labels):
if token[0] != "~" and token[0] != "@":
db_label = models.Label()
db_label.task = db_task
db_label.name = token
db_label.save()
elif db_label != None:
global_logger.info("labels with attributes for task #{} is {}".format(
db_task.id, params['labels']))
parsed_labels = _parse_labels(params['labels'])
for label in parsed_labels:
db_label = models.Label()
db_label.task = db_task
db_label.name = label
db_label.save()

for attr in parsed_labels[label]:
db_attrspec = models.AttributeSpec()
db_attrspec.label = db_label
db_attrspec.text = token
db_attrspec.text = parsed_labels[label][attr]['text']
db_attrspec.save()
else:
raise ValueError("Invalid labels format {}".format(labels))

db_task.mode = mode
db_task.save()

0 comments on commit dea2724

Please sign in to comment.