cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.4k stars 2.98k forks source link

How to create upload annotation of polygon points to a job to create polygon tracks for multiple frames? #8214

Closed gwengusc closed 2 months ago

gwengusc commented 2 months ago

Hi,

I used this api to create polygon shape for the masks I stored in the format of polygon points. And it works. but I have to create the polygon shape for each frame. and the code is like:


with ApiClient(configuration) as api_client:
    action = "create"  # str |
    id = 24  # int | A unique integer value identifying this job.
    patched_labeled_data_request = PatchedLabeledDataRequest(
        version=0,
        shapes=[
            LabeledShapeRequest(
                outside=False,
                z_order=0,
                rotation=0.0,
                frame=0,
                label_id=33,
                group=0,
                source="manual",
                attributes=[],
                points=[
                    1067, 181,
                    1052, 330,
                    906, 340,
                    ......
                ],
                type=ShapeType("polygon"),
                occluded=False,
            ),
        ],
    )  # PatchedLabeledDataRequest |  (optional)
    try:
        # (data, response) = api_client.jobs_api.partial_update_annotations(
        (data, response) = api_client.tasks_api.partial_update_annotations(
            action,
            id,
            patched_labeled_data_request=patched_labeled_data_request,
        )
    except exceptions.ApiException as e:
        print("Exception when calling JobsApi.partial_update_annotations(): %s\n" % e)

I just want to know how to create the mask as polygon track from frame 0-n? so that I do not have to create mask for every frame

https://docs.cvat.ai/docs/api_sdk/sdk/reference/apis/jobs-api/#partial_update_annotations

I used LabeledTrackRequest which does create track, but it is a track from the frame I specifiy to the last frame of the dataset, and there is no interporlation. I want to the track only created for frames from 1-10.

Basically, I am looking for API to do this https://github.com/cvat-ai/cvat/issues/5401#issuecomment-1333601084

There is an object moving among frame 1 to 10. So I need interpolation between those frames.

Thanks

zhiltsov-max commented 2 months ago

Hi. If you want to upload a track, just put in in the tracks field, instead of shapes. Example.