37 Commits (8f71d90af49b67e93e9d9fd4fb173a956858d875)

Author SHA1 Message Date
Maxim Zhiltsov 31f0578220
Add a way to create task with custom jobs (#5536)
This PR adds an option to specify file to job mapping explicitly during
task creation. This option is incompatible with most other job-related
parameters like `sorting_method` and `frame_step`.

- Added a new task creation parameter (`job_file_mapping`) to set a
custom file to job mapping during task creation
3 years ago
Roman Donchenko 3d9c5add94
SDK: fix string field serialization for multipart/form-data requests (#5479)
Django REST Framework ignores the Content-Type on request body parts, so
it doesn't know that they are JSON-encoded. Instead, it just tries to
decode each part as if it was an `str()`-encoded value.

Change the encoding to match the decoding. The only type this matters
for is `str`, because `json.dumps` and `str` produce different encodings
for `str` values.

Remove `none_type` from the list of encodable types since, to my
knowledge, there's no way to encode a `None` value as a
`multipart/form-data` part in a way that DRF will understand.
3 years ago
Roman Donchenko 33c624ae1e
PyTorch adapter: add a way to disable cache updates (#5549)
This will let users to run their PyTorch code without network access,
provided that they have already cached the data.

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->
Unit tests.
3 years ago
Roman Donchenko e6025a54f3
Split cvat_sdk/pytorch/__init__.py into multiple files (#5543) 3 years ago
Maxim Zhiltsov c808471d84
Improve SDK UX with task creation (#5502)
Extracted from https://github.com/opencv/cvat/pull/5083

- Added a default arg for task data uploading
- Added an option to wait for the data processing in task data uploading
- Moved data splitting by requests for TUS closer to the point of use
3 years ago
Maria Khrustaleva c91cf8accd
Add filename pattern to cli (#5525)
Add ability to create task with `filename_pattern` by cli.
3 years ago
Roman Donchenko ce37be1f60
SDK: add a ProjectVisionDataset class (#5523) 3 years ago
Roman Donchenko 4d32c3c686
SDK: make the dataset cache directory customizable (#5535)
This is useful for people whose home directory is too small/not fast
enough. It also lets us make the tests less hacky.
3 years ago
Andrey Zhavoronkov 52e3f3c28a
Added tests for preview endpoints (#5529) 3 years ago
Maxim Zhiltsov a773042e4e
SDK / CLI v2.3.0 (#5511)
- Updated package versions
- Extended server version list in SDK to 2.4 for the public instance
3 years ago
Andrey Zhavoronkov 1ecc607286
Get preview images on the fly and keep them in cache (#5478)
Improved image preview loading for **Tasks**, **Jobs** and **Projects**
views
Backend behaviour change: creating image previews by request and storing
them in the cache
Added corresponding endpoints:
tasks/{id}/preview
projects/{id}/preview
jobs/{id}/preview

Demonstration(added random 0-1s delay for demo purposes):
https://user-images.githubusercontent.com/41117609/208106321-951b8647-6e6b-452e-910c-31c4d0b8682d.mp4
https://user-images.githubusercontent.com/41117609/208106339-2d3a5a7b-d422-4b27-9e76-08729022e1ca.mp4
3 years ago
Roman Donchenko e018b10e00
SDK: fix `Project.import_dataset` incorrectly waiting for completion (#5459)
You have to use the `import_status` action in order to query the input
status. Otherwise, the `/api/projects/{id}/dataset/` endpoint initiates
a dataset export. Currently, `import_dataset` inadvertently monitors the
status of that export, not the original import.
3 years ago
Roman Donchenko fa92ccb987
SDK: Improve the PyTorch adapter layer (#5455)
* Make the extractors return tensors instead of Python data structures.
* Let the user specify custom label IDs.
3 years ago
Maxim Zhiltsov 6cf67dba9e
Add project proxy tests in SDK (#5431)
Ported from https://github.com/opencv/cvat/pull/4819

- Fixed project APIs in SDK core
- Added tests for projects
3 years ago
Roman Donchenko 487c60ce2b
SDK: Add an adapter layer that presents a CVAT task as a torchvision dataset (#5417) 3 years ago
Roman Donchenko 0a032b3236
Migrate to using pathlib in most of the SDK (#5435)
For user-facing functions, keep accepting `str` paths to maintain
compatibility and flexibility, but add support for arbitrary path-like
objects. For internal functions (in `downloading.py` and
`uploading.py`), don't bother and require `pathlib.Path`.

The only code that isn't converted is build-time code (e.g. `setup.py`)
and code that came from openapi-generator.
3 years ago
Roman Donchenko 192fd72680
Fix creation of tasks with Git repositories via the SDK (#5409)
Fixes #4365
3 years ago
Roman Donchenko 38193ff792
SDK: add a utility function for atomically writing a file (#5372) 3 years ago
Roman Donchenko 0a16cfce5b
SDK: add a high-level method to download task data chunks (#5356) 3 years ago
Roman Donchenko aadfd8814e
Fix TUS offset queries in production environments (#5204)
* Fix TUS offset queries in production environments

Previously, `mod_wsgi` would convert `HEAD` requests into `GET`, which
would be rejected, so clients were unable to resume an upload that failed
midway through.

To make use of this, update the SDK code to enable upload resumption.

* Add a test that forces a chunked TUS upload

* test_can_create_from_backup_in_chunks: make sure the upload is actually chunked
3 years ago
Roman Donchenko 12961b35d6
cvat-sdk: make sure to redraw the progress bar after use (#5235)
tqdm does not necessarily redraw the progress bar after every update,
and without the call to `refresh` it might not update it to the final state.

I discovered this while writing a test in which the progress bar is updated
in chunks, and the last chunk is smaller than the previous ones.
3 years ago
Kirill Sizov dbcfb30cb2
Fix SDK tests (#5077)
* Update SDK tests to use LoginSerializerEx
3 years ago
Maxim Zhiltsov 511f9706d5
Allow trailing slashes in SDK client url (#5057) 3 years ago
Роман Донченко b029bc9da8
cvat-sdk: Fix creating tasks with non-local files (#5058)
* Move the test file share contents to tests/share

This way, it can be reused between tests.

* cvat-sdk: Fix creating tasks with non-local files

Forcing the `Content-Type` for the `upload_data` API call to
`multipart/form-data` does not work, because the current logic for
converting Python values to parts (`ApiClient._convert_body_to_post_params`)
does not encode them in a way that Django REST Framework can understand (it
JSON-encodes each part).

Fortunately, we don't actually need to do that, since when we create a task
with non-local files, we don't need to upload any files, and so we can just
post the original JSON, so do just that.

I couldn't add a test for the remote image case, because CVAT rejects all URLs
with non-public IP addressses. However, I did test this case manually.
3 years ago
Maxim Zhiltsov 1902ecd8a7
Extend SDK layer 2 docs (#4980) 3 years ago
Maxim Zhiltsov 426f8e3ef0
Extend SDK layer 1 docs (#5011) 3 years ago
Maxim Zhiltsov 2e15025434
Check server version in SDK (#4935) 3 years ago
Maxim Zhiltsov 68375ec23e
Add SDK docs (#4928)
- Added auth docs in API schema and SDK ApiClient/Config (fixes #1517)
- Added SDK docs with API, SDK and CLI docs
- Added `develop` branch in the docs
- Allowed unauthorized access to `api/docs`, `api/swagger`, `api/schema` endpoints
- Added `--insecure` env var to control host checks in CLI
- Refactored `build_docs.py` (backported https://github.com/openvinotoolkit/datumaro/pull/589)
- Extracted requirements file for site
3 years ago
Maxim Zhiltsov 4f6e81eab3
Bump sdk and cli versions (#4923) 3 years ago
Maxim Zhiltsov f966df7493
Fix python3.7 compatibility (#4919) 3 years ago
Maxim Zhiltsov 7218f4e283
Add host schema auto-detection in SDK (#4910) 3 years ago
Maxim Zhiltsov 1dcba5a843
Align server api, sdk and cli versions to 2.1.0 (#4913) 3 years ago
Maxim Zhiltsov 917e821348
SDK alpha 1 release (#4903) 3 years ago
Maxim Zhiltsov 53697ecac5
SDK layer 2 - cover RC1 usecases (#4813) 4 years ago
Maxim Zhiltsov 5f58a0f7be
Add 2nd layer of SDK (#19) 4 years ago
Maria Khrustaleva 164c2c34df
Images should be searched relative to the manifest file on cloud storage (#8) 4 years ago
Maxim Zhiltsov 7b2fc54e20
Add CVAT SDK package (#7) 4 years ago