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

Unable to use task retrieve_annotations API to get Pascal VOC 1.1 labels #6241

Closed
yf-yang opened this issue Jun 5, 2023 · 2 comments
Closed
Labels
question Further information is requested

Comments

@yf-yang
Copy link

yf-yang commented Jun 5, 2023

My actions before raising this issue

(data, response) = api_client.tasks_api.retrieve_annotations(93, format='PASCAL VOC 1.1')

Calling the API above yields the following result:

Traceback (most recent call last):
  File "/Users/admin/Workspace/data_collection_bot/get_annotations.py", line 15, in <module>
    (data, response) = api_client.tasks_api.retrieve_annotations(
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/api/tasks_api.py", line 3437, in retrieve_annotations
    return self.retrieve_annotations_endpoint.call_with_http_info(**kwargs)
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/api_client.py", line 1058, in call_with_http_info
    return self.api_client.call_api(
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/api_client.py", line 497, in call_api
    return self.__call_api(**params)
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/api_client.py", line 282, in __call_api
    return_data = self.deserialize(
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/api_client.py", line 389, in deserialize
    deserialized_data = validate_and_convert_types(
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 1590, in validate_and_convert_types
    converted_instance = attempt_convert_item(
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 1479, in attempt_convert_item
    raise conversion_exc
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 1470, in attempt_convert_item
    return deserialize_model(input_value, valid_class,
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 1386, in deserialize_model
    return model_class._new_from_openapi_data(model_data, **kw_args)
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 51, in wrapped_init
    return fn(_self, *args, **kwargs)
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 355, in _new_from_openapi_data
    oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg)
  File "/Users/admin/miniconda3/lib/python3.10/site-packages/cvat_sdk/api_client/model_utils.py", line 1904, in get_oneof_instance
    raise ApiValueError(
cvat_sdk.api_client.exceptions.ApiValueError: Invalid inputs given to generate an instance of AnnotationsRead. Multiple oneOf schemas matched the inputs, but a max of one is allowed.

I've searched the source code and found out that the problem happens when the response is deserialized and matched with AnnotationsRead, but the response.data field is actually empty.

I am not sure what the exact problem is.
Am I calling the API in a correct way? I have no idea what the returned response should be and where can I retrieve the data. I also tried to directly export it from the UI and I got a zip file, so I expect it is returned as something like a string buffer.

@zhiltsov-max
Copy link
Contributor

Hi, please read this answer about dataset downloading. Everything is the same for downloading annotations. Please also consider using the high-level SDK, which allows downloading annotations and datasets simpler.

@zhiltsov-max zhiltsov-max added the question Further information is requested label Jun 5, 2023
@yf-yang
Copy link
Author

yf-yang commented Jun 6, 2023

Awesome! Would you please consider updating doc in this doc(and job/project's retrieve_annotations)? I haven't read the page about low level API before and every time I directly go to the API reference page because it offers examples as well. I believe people encounter similar issues because they are checking the wrong page.

@yf-yang yf-yang closed this as completed Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants