Skip to content

high-level SDK does not support uploading annotations from the cloud #9019

Open
@burak43

Description

@burak43

Actions before raising this issue

  • I searched the existing issues and did not find anything similar.
  • I read/searched the docs

Steps to Reproduce

from cvat_sdk import make_client
from cvat_sdk.core.proxies.tasks import ResourceType

with make_client(host="host", credentials=('user', 'password')) as client:
    task_spec = {
        "name": "dummy task",
        "project_id": 1,
        "source_storage": {'location': 'cloud_storage', 'cloud_storage_id': 1},
        "target_storage": {'location': 'cloud_storage', 'cloud_storage_id': 1},
    }
    data_params = {
        "cloud_storage_id": 1,
        "image_quality": 70,
        "sorting_method": "natural",
        "frame_step": 1,
    }

    task = client.tasks.create_from_data(
        spec=task_spec,
        resource_type=ResourceType.SHARE,
        resources=['path/to/s3/key/dir/'],
        data_params=data_params
    )

    # Upload annotations (since filename is s3 path, filename.stat() will fail.)
    task.import_annotations(
        format_name="COCO 1.0",
        filename='path/to/s3/key/dir/coco.json'
    )

when importing annotaions from cloud storage, filename.stat() will fail as filename is not a local file. Passing annotation_path and annotation_format to create_from_data will also fail. Then, what's the purpose of having source_storage in the task_spec if one cannot import resources from the cloud using high-level SDK?

Expected Behavior

Import annotations from the specified cloud storage.

Possible Solution

Provide a modified Uploader class that does not depent on a stream for the annotation file.

Context

Open a task using data and annotations both are available on the attached cloud storage. Task with data (images) can be opened but annotations cannot be uploaded from the cloud storage.

Environment

Python 3.11.9
VERSION = "2.25.0"

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions