Git Product home page Git Product logo

cvat_python_wrapper's Introduction

CVAT wrapper

Description

Python wrapper to wrap CVAT API call into a class.

Example

from CVAT import CVAT
from CVAT.data_types import Task

API = CVAT(username="username", password="password", url="http://localhost:8080")

project_id: int = API.create_project("New project")
task: Task = Task("new task", project_id=project_id)
task = API.create_task(task)

Documentation

All the documentation is made with python google docstring.

Contributors

  • Antoine Desruet github-link

cvat_python_wrapper's People

Contributors

antwxne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cvat_python_wrapper's Issues

Adding annotation loading to a task

Hello.
I liked your repository. But for my project, I need to load the annotation into tasks via api from an already generated XML file.
Is it possible to add such functionality at least for the CVAT 1.1 annotation?

Sample usage don't work on fresh python=3.9 env

During call API = CVAT(username="username", password="password", url="http://localhost:8080")
with proper credetentials

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File ~/anaconda3/envs/py39/lib/python3.9/site-packages/requests/models.py:972, in Response.json(self, **kwargs)
    971 try:
--> 972     return complexjson.loads(self.text, **kwargs)
    973 except JSONDecodeError as e:
    974     # Catch JSON-related errors and raise as requests.JSONDecodeError
    975     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File ~/anaconda3/envs/py39/lib/python3.9/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:

File ~/anaconda3/envs/py39/lib/python3.9/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
    333 """Return the Python representation of ``s`` (a ``str`` instance
    334 containing a JSON document).
    335 
    336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338 end = _w(s, end).end()

File ~/anaconda3/envs/py39/lib/python3.9/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
    354 except StopIteration as err:
--> 355     raise JSONDecodeError("Expecting value", s, err.value) from None
    356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 API = CVAT( username="gytarasov", password="Tar-2022@", url="http://cvat.rcud-rt.ru/")

File ~/anaconda3/envs/py39/lib/python3.9/site-packages/CVAT/__init__.py:37, in CVAT.__init__(self, username, password, url)
     31 body: dict = {
     32     "username": username,
     33     "password": password
     34 }
     35 response: Response = self.session.post(url=f'{self.url}/api/auth/login',
     36                                        json=body)
---> 37 self.session.headers = {"Authorization": f'Token {response.json()["key"]}'}
     38 if response.status_code != 200:
     39     raise ValueError("Bad credentials")

File ~/anaconda3/envs/py39/lib/python3.9/site-packages/requests/models.py:976, in Response.json(self, **kwargs)
    972     return complexjson.loads(self.text, **kwargs)
    973 except JSONDecodeError as e:
    974     # Catch JSON-related errors and raise as requests.JSONDecodeError
    975     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 976     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Create project inside an specific organization ID

Hello, I really like your project.
I would like to make you a query. Do you see any way to create a project within a specific organization?
So far I have only managed to create projects in my personal space in CVAT.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.