cvat
cvat copied to clipboard
Unable to set/modify parameters of task data via REST
My actions before raising this issue
- [x] Read/searched the docs
- [x] Read source code, especially the tests.
- [x] Searched past issues
The core issue is slow play of frame-by-frame in the UI. After tweaking the tasks data, `use_zip_chunks=True' and chunk size manually the user experience is improved and frame-by-frame play is smooth.
The issue is, using the REST API I was unable to modify any of these parameters.
Expected Behaviour
Posting a Task `"use_zip_chunks": true`
import json
from loguru import logger
import requests
TASK_DICT = {
"name": "MyTest",
"owner_id": "1",
"assignee": None,
"overlap": 20,
# "segment_size": 40,
"z_order": False,
"image_quality": 50,
"labels": [],
"project_id": "6",
}
DATA_DICT = {
"image_quality": 70,
"compressed_chunk_type": "imageset",
"original_chunk_type": "video",
"server_files[0]": 'testing_cvat_speed_vs_quality.mp4',
# "server_files": {
# 0: Required()
# },
"use_zip_chunks": True,
"use_cache": False,
"copy_data": False
}
cvat_url = 'https://my_cvat_server/api/v1'
auth = (
'auth',
"user"
)
def create_task_via_rest(task_data):
resp = requests.post(cvat_url + '/tasks', auth=auth, data=task_data)
resp.raise_for_status()
return resp.json()
def add_data_to_task(task_id,data_dict):
resp = requests.post(cvat_url + f'/tasks/{task_id}/data', auth=auth, data=data_dict)
resp.raise_for_status()
return resp.json()
if __name__ == '__main__':
TASK_DICT['name'] = 'TestTask'
resp = create_task_via_rest(TASK_DICT)
# print(json.dumps(resp, indent=4))
task_id = resp["id"]
logger.warning(f"{task_id =}")
dresp = add_data_to_task(task_id=task_id, data_dict=DATA_DICT)
logger.debug(json.dumps(dresp, indent=4))
Current Behaviour
Logged result `"use_zip_chunks": false`
2022-06-01 13:40:20.178 | WARNING | __main__:<module>:53 - task_id =2601
2022-06-01 13:40:21.029 | DEBUG | __main__:<module>:55 - {
"chunk_size": null,
"size": 0,
"image_quality": 70,
"start_frame": 0,
"stop_frame": 0,
"frame_filter": "",
"compressed_chunk_type": "imageset",
"original_chunk_type": "video",
"client_files": [],
"server_files": [
"testing_cvat_speed_vs_quality.mp4"
],
"remote_files": [],
"use_zip_chunks": false,
"use_cache": false,
"copy_data": false,
"storage_method": "file_system",
"storage": "local"
}
Possible Solution
Steps to Reproduce (for bugs)
- Run the code provided replacing auth and relevant endpoints.
Context
Your Environment
- Git hash commit (
git log -1
):
commit b7a50acff29ea36ab1b2a6c67e6d94ccc4bcd2b6 (HEAD -> develop, origin/develop, origin/HEAD)
Author: Andrey Zhavoronkov <[email protected]>
Date: Sat Dec 25 19:14:49 2021 +0300
Added information about OpenVINO toolkit to login page (#4077)
Co-authored-by: Boris Sekachev <[email protected]>
Co-authored-by: Boris Sekachev <[email protected]>
Co-authored-by: Nikita Manovich <[email protected]>
- Docker version
docker version
(e.g. Docker 17.0.05):
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:33 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:42 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Are you using Docker Swarm or Kubernetes?
- No.
Operating System and version (e.g. Linux, Windows, MacOS):
-
Linux 5.4.0-109-generic
Code example or link to GitHub repo or gist to reproduce problem:
- Given above.
- Video is a short 240 frame test video, any replacement will do
Thanks in advanced, Elad.
Hi! I can see you're using the response data to check the options used in the data uploading. Probably, the only significant part of the response in it's status code. The options set are used in the request processing code, but they don't get to the response. Probably, we need to update the endpoint/method documentation about the response value. Could you say if you see any use cases if the response value is needed, or the task creation options could be useful?
We have recently released cvat-sdk
and cvat-cli
packages on PyPI. If you're interested in REST API. please also check them and the updated REST API docs here.