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

Python SDK Support #4637

Closed
manoj130 opened this issue May 13, 2022 · 8 comments · Fixed by #4903
Closed

Python SDK Support #4637

manoj130 opened this issue May 13, 2022 · 8 comments · Fixed by #4903
Assignees
Labels
enhancement New feature or request sdk/cli

Comments

@manoj130
Copy link

I want to interact with CVAT in local server and docker with CMD using python script
is there a stable python API to create and upload and download data from CVAT

@bsekachev
Copy link
Member

Hello,

We have only a CLI interface (https://github.com/openvinotoolkit/cvat/tree/develop/utils/cli), but actually it is not well spported and may not to work time to time.
You can consider CVAT REST API as a quite stable and write a simple Python wrapper around it. Generally, having such SDK is a good idea, I believe.

@zhiltsov-max
Copy link
Contributor

Hi. No, there is no dedicated library for this yet. I think, we could add such SDK in future. Do you have any specific requests about its functionality? Basically it could duplicate the CLI functionality.

@manoj130
Copy link
Author

All i want to do is integrate this Cvat tool to my code and get access of annotations to a variable level

@nmichlo
Copy link

nmichlo commented Jun 2, 2022

An official python API that matches the REST API would be an excellent feature. It would make development of many tasks much quicker too.

EDIT: could use the open api generator: https://github.com/OpenAPITools/openapi-generator#openapi-generator

Export the json definitions, and save them as cvat_api.json:

http://<url>/api/schema?scheme=json

Then create the API:

docker run --rm \
    -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
    -i /local/cvat_api.json \
    -g python \
    -o /local/cvat_api

@dasturge
Copy link

@nmichlo any other way I could get the schema? This doesn't seem to work on my instance, I get "The requested resource was not found on this server"

@nmichlo
Copy link

nmichlo commented Jun 21, 2022

@dasturge Try starting your own CVAT instance locally?

git clone https://github.com/openvinotoolkit/cvat
cd cvat
docker-compose -f docker-compose.yml -f components/serverless/docker-compose.serverless.yml up
docker exec -it cvat bash -ic 'python3 ~/manage.py createsuperuser'

Make sure to login at http://localhost:8080 before visiting http://localhost:8080/api/schema/?scheme=json


One thing I have noticed is that the returned schema from CVAT seems wrong. The generator is not able to generate a valid CLI, you need to go in and make manual changes to get it working.

@dasturge
Copy link

@nmichlo I tried these steps and they did not work for me. Still "The requested resource was not found on this server".

@zhiltsov-max zhiltsov-max self-assigned this Aug 25, 2022
@zhiltsov-max zhiltsov-max added enhancement New feature or request sdk/cli labels Aug 25, 2022
@zhiltsov-max zhiltsov-max mentioned this issue Sep 5, 2022
7 tasks
@zhiltsov-max
Copy link
Contributor

zhiltsov-max commented Sep 7, 2022

Hi, we have published cvat-cli package on PyPI. Install with pip install cvat-cli.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sdk/cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants