Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
547a1db
checking for 'id' only if attribute has one, else leave name as is
VahagnTKA Nov 6, 2022
a39bdf1
fixing chunk size issue with listing names
VahagnTKA Nov 6, 2022
b40eb65
fix getting project
VahagnTKA Nov 6, 2022
e97c847
make validate
VahagnTKA Nov 6, 2022
db74f92
using correct baseclasses
VahagnTKA Nov 7, 2022
72038bc
Deprecation Tasks
VaghinakDev Nov 7, 2022
a40b3a4
Merge pull request #526 from superannotateai/1289_download_image
TumanyanV Nov 7, 2022
955831a
Merge pull request #525 from superannotateai/1458_upload_images
TumanyanV Nov 7, 2022
0206c31
Merge pull request #524 from superannotateai/1472_assign_folder
TumanyanV Nov 7, 2022
8c8716a
using the ssl_verify variable
VahagnTKA Nov 7, 2022
983dd9a
Merge branch 'friday' of github.com:superannotateai/superannotate-pyt…
VahagnTKA Nov 7, 2022
3a5403f
Fix encoding issue
VaghinakDev Nov 7, 2022
6d83cfe
Merge pull request #527 from superannotateai/1491_1494
VaghinakDev Nov 8, 2022
9857ed8
Merge pull request #529 from superannotateai/1388_win
VaghinakDev Nov 8, 2022
8cc7f81
adding pagination with chunk sizes
VahagnTKA Nov 8, 2022
50a1c22
Update __init__.py
VaghinakDev Nov 8, 2022
31e869a
Create README.rst
VaghinakDev Nov 9, 2022
d0c11da
Update README.rst
VaghinakDev Nov 9, 2022
2713193
Update README.rst
VaghinakDev Nov 9, 2022
ef140ab
Delete README.md
VaghinakDev Nov 9, 2022
7e93c44
Updated readme file
VaghinakDev Nov 9, 2022
9c19ea7
Merge pull request #530 from superannotateai/1456_upload_annotations
VaghinakDev Nov 9, 2022
45a1359
Fix tests
VaghinakDev Nov 9, 2022
ea19f47
Update README.rst
VaghinakDev Nov 10, 2022
6cb61b4
Update __init__.py
VaghinakDev Nov 10, 2022
4201f50
README fix
VaghinakDev Nov 10, 2022
187ce83
Merge branch 'friday' of https://github.com/superannotateai/superanno…
VaghinakDev Nov 10, 2022
69878ac
Readme fix
VaghinakDev Nov 10, 2022
a32853a
Readme fix
VaghinakDev Nov 10, 2022
5dab057
aggregastions change
VaghinakDev Nov 10, 2022
12355d1
updated per_frame convertor
VaghinakDev Nov 10, 2022
0738846
Fix setup.py
VaghinakDev Nov 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions README.md

This file was deleted.

128 changes: 128 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
SuperAnnotate Python SDK
===============================
|Python| |License| |Changelog|


Welcome to the SuperAnnotate Python Software Development Kit (SDK), which enables Python programmers to create software that incorporates services of the platform and effortlessly integrates SuperAnnotate into their AI process.

.. |Python| image:: https://img.shields.io/static/v1?label=python&message=3.7/3.8/3.9/3.10/3.11&color=blue&style=flat-square
:target: https://pypi.org/project/superannotate/
:alt: Python Versions
.. |License| image:: https://img.shields.io/static/v1?label=license&message=MIT&color=green&style=flat-square
:target: https://github.com/superannotateai/superannotate-python-sdk/blob/master/LICENSE/
:alt: License
.. |Changelog| image:: https://img.shields.io/static/v1?label=change&message=log&color=yellow&style=flat-square
:target: https://github.com/superannotateai/superannotate-python-sdk/blob/master/CHANGELOG.md
:alt: Changelog

Resources
---------------

- API Reference and User Guide available on `Read the Docs <https://superannotate.readthedocs.io/en/stable/superannotate.sdk.html>`__
- `Platform documentation <https://doc.superannotate.com/>`__


Authentication
---------------

.. code-block:: python

>>> from superannotate import SAClient
# by environment variable SA_TOKEN
>>> sa_client = SAClient()
# by token
>>> sa_client = SAClient(token='<team token>')
# by config file
# default path is ~/.superannotate/config.json
>>> sa_client = SAClient(config_path='~/.superannotate/dev_config.json')

Using superannotate
-------------------

.. code-block:: python

>>> from superannotate import SAClient
>>> sa_client =SAClient()
>>> project = 'Dogs'
>>> sa_client.create_project(
project_name=project,
project_description='Test project generated via SDK',
project_type='Vector'
)
>>> sa_client.create_annotation_class(
project=project,
name='dog',
color='#F9E0FA',
class_type='tag'
)
>>> sa_client.attach_items(
project=project,
attachments=[
{
'url': 'https://drive.google.com/uc?export=download&id=1ipOrZNSTlPUkI_hnrW9aUD5yULqqq5Vl',
'name': 'dog.jpeg'
}
]
)
>>> sa_client.upload_annotations(
project=project,
annotations=[
{
'metadata': {'name': 'dog.jpeg'},
'instances': [
{'type': 'tag', 'className': 'dog'}
]
}
]
)
>>> sa_client.get_annotations(project=project, items=['dog.jpeg'])

Installation
------------

SuperAnnotate python SDK is available on PyPI:

.. code-block:: bash

pip install superannotate


The package officially supports Python 3.7+ and was tested under Linux and
Windows (`Anaconda <https://www.anaconda.com/products/individual#windows>`__
) platforms.

For more detailed installation steps and package usage please have a look at the `tutorial <https://superannotate.readthedocs.io/en/stable/tutorial.sdk.html>`__


Supported Features
------------------

- search/get/create/clone/update/delete projects
- search/get/create/delete folders
- assign folders to project contributors
- upload items to a project from a local or AWS S3 folder
- attach items by URL or from an integrated storage, meanwhile keeping them secure in your cloud provider
- get integrated cloud storages
- upload annotations (also from local or AWS S3 folder)
- delete annotations
- set items annotations statuses
- get/download/export annotations from a project (also to a local or AWS S3 folder)
- invite/search team contributors or add contributors to a specific project
- search/get/copy/move items in a project
- query items using SA Query Language
- define custom metadata for items and upload custom values (query based on your custom metadata)
- upload priority scores
- get available subsets (sets of segregated items), query items in a subset or add items to a subset
- assign or anassign items to project contributors
- download an image that has been uploaded to project
- search/create/download/delete project annotation classes
- search/download models
- run predictions
- convert annotations from/to COCO format
- convert annotation from VOC, SuperVisely, LabelBox, DataLoop, VGG, VoTT, SageMaker, GoogleCloud, YOLO formats
- CLI commands for simple tasks

Questions and Issues
--------------------

For questions and issues please use this repo’s issue tracker on GitHub or contact support@superannotate.com.
2 changes: 0 additions & 2 deletions docs/source/superannotate.sdk.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ ________
.. automethod:: superannotate.SAClient.upload_videos_from_folder_to_project
.. _ref_upload_annotations_from_folder_to_project:
.. automethod:: superannotate.SAClient.upload_annotations_from_folder_to_project
.. automethod:: superannotate.SAClient.upload_preannotations_from_folder_to_project
.. automethod:: superannotate.SAClient.add_contributors_to_project
.. automethod:: superannotate.SAClient.get_project_settings
.. automethod:: superannotate.SAClient.set_project_default_image_quality_in_editor
Expand Down Expand Up @@ -107,7 +106,6 @@ ______
.. automethod:: superannotate.SAClient.download_image
.. automethod:: superannotate.SAClient.download_image_annotations
.. automethod:: superannotate.SAClient.upload_image_annotations
.. automethod:: superannotate.SAClient.copy_image
.. automethod:: superannotate.SAClient.pin_image
.. automethod:: superannotate.SAClient.add_annotation_bbox_to_image
.. automethod:: superannotate.SAClient.add_annotation_point_to_image
Expand Down
10 changes: 3 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ def get_version():
with open("requirements.txt") as f:
requirements.extend(f.read().splitlines())

with open('README.md') as f:
readme = f.read()

readme = "\n".join(readme.split('\n')[2:])

setup(
name='superannotate',
Expand All @@ -31,12 +27,12 @@ def get_version():
description='Python SDK to SuperAnnotate platform',
license='MIT',
author='SuperAnnotate AI',
author_email='suppoort@superannotate.com',
url='https://github.com/superannotateai/superannotate-python-sdk',
long_description=readme,
long_description_content_type='text/markdown',
long_description=open('README.rst').read(),
long_description_content_type='text/x-rst',
install_requires=requirements,
setup_requires=['wheel'],
description_file="README.md",
entry_points={
'console_scripts': ['superannotatecli = superannotate.lib.app.bin.superannotate:main']
},
Expand Down
2 changes: 1 addition & 1 deletion src/superannotate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys


__version__ = "4.4.5"
__version__ = "4.4.6dev4"


sys.path.append(os.path.split(os.path.realpath(__file__))[0])
Expand Down
9 changes: 5 additions & 4 deletions src/superannotate/lib/app/analytics/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class DataAggregator:
"polygon": lambda annotation: annotation["points"],
"polyline": lambda annotation: annotation["points"],
"cuboid": lambda annotation: annotation["points"],
"comment": lambda annotation: annotation["points"],
"point": lambda annotation: {"x": annotation["x"], "y": annotation["y"]},
"annotation_type": lambda annotation: dict(
cx=annotation["cx"],
Expand Down Expand Up @@ -123,7 +124,7 @@ def annotation_suffix(self):
self._annotation_suffix = PIXEL_ANNOTATION_POSTFIX
else:
self._annotation_suffix = ATTACHED_VIDEO_ANNOTATION_POSTFIX
return self._annotation_suffix
return ATTACHED_VIDEO_ANNOTATION_POSTFIX

def get_annotation_paths(self):
annotations_paths = []
Expand Down Expand Up @@ -378,7 +379,7 @@ def __append_annotation(annotation_dict):

for annotation_path in annotations_paths:
annotation_json = json.load(open(annotation_path))
parts = annotation_path.name.split(self.annotation_suffix)
parts = Path(annotation_path).name.split(self.annotation_suffix)
if len(parts) != 2:
continue
image_name = parts[0]
Expand Down Expand Up @@ -449,8 +450,8 @@ def __append_annotation(annotation_dict):
attributes = annotation.get("attributes")
user_metadata = self.__get_user_metadata(annotation)
folder_name = None
if annotation_path.parent != Path(self.project_root):
folder_name = annotation_path.parent.name
if Path(annotation_path).parent != Path(self.project_root):
folder_name = Path(annotation_path).parent.name
num_added = 0
if not attributes:
annotation_dict = {
Expand Down
38 changes: 5 additions & 33 deletions src/superannotate/lib/app/interface/cli_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,6 @@ def export_project(
)
sys.exit(0)

def upload_preannotations(
self, project, folder, dataset_name=None, task=None, format=None
):
"""
To upload preannotations from folder to project use
Optional argument format accepts input annotation format. It can have COCO or SuperAnnotate values.
If the argument is not given then SuperAnnotate (the native annotation format) is assumed.
Only when COCO format is specified dataset-name and task arguments are required.
dataset-name specifies JSON filename (without extension) in <folder_path>.
task specifies the COCO task for conversion. Please see import_annotation_format for more details.
"""
self._upload_annotations(
project=project,
folder=folder,
format=format,
dataset_name=dataset_name,
task=task,
pre=True,
)
sys.exit(0)

def upload_annotations(
self, project, folder, dataset_name=None, task=None, format=None
):
Expand All @@ -167,13 +146,10 @@ def upload_annotations(
format=format,
dataset_name=dataset_name,
task=task,
pre=False,
)
sys.exit(0)

def _upload_annotations(
self, project, folder, format, dataset_name, task, pre=True
):
def _upload_annotations(self, project, folder, format, dataset_name, task):
project_folder_name = project
project_name, folder_name = split_project_path(project)
project = SAClient().controller.get_project(project_name)
Expand All @@ -197,14 +173,10 @@ def _upload_annotations(
task=task,
)
annotations_path = temp_dir
if pre:
SAClient().upload_preannotations_from_folder_to_project(
project_folder_name, annotations_path
)
else:
SAClient().upload_annotations_from_folder_to_project(
project_folder_name, annotations_path
)

SAClient().upload_annotations_from_folder_to_project(
project_folder_name, annotations_path
)
sys.exit(0)

def attach_image_urls(
Expand Down
Loading