Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
burak43 opened this issue Jan 30, 2025 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@burak43
Copy link

burak43 commented Jan 30, 2025

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"
@burak43 burak43 added the bug Something isn't working label Jan 30, 2025
@Sunnykumar926
Copy link

Sunnykumar926 commented Feb 2, 2025

I thought that when we try to import annotations from cloud storage, we get an error due to filename.stat(), as it checks for a local path while we provide 'path/to/s3/key/dir/coco.json'. To import the annotations, we first download the annotation file from cloud storage to local and then import it. please tell my i am correct or not

@Marishka17 Marishka17 self-assigned this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants