Skip to content

Commit 79a505c

Browse files
authored
Merge pull request #532 from superannotateai/develop
Develop
2 parents 9a86a73 + 43c6bc6 commit 79a505c

21 files changed

+238
-607
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22
All release highlights of this project will be documented in this file.
3+
4+
## 4.4.6 - November 23, 2022
5+
### Updated
6+
- `SAClient.aggregate_annotations_as_df` method to aggregate "comment" type instances.
7+
- `SAClient.add_annotation_bbox_to_image`, `SAClient.add_annotation_point_to_image`, `SAClient.add_annotation_comment_to_image` _methods_ to add deprecation warnings.
8+
### Fixed
9+
- Special characters are being encoded after annotation upload (Windows)
10+
- `SAClient.assign_folder` _method_ to address the invalid argument name.
11+
- `SAClient.upload_images_from_folder_to_project` _method_ to address uploading of more than 500 items.
12+
- `SAClient.upload_annotations_from_folder_to_project` _method_ to address the issue of a folder size being more than 25,5 MB.
13+
- `SAClient.download_image` _method_ to address the KeyError 'id' when `include_annotations` is set to `True`.
14+
### Removed
15+
`SAClient.upload_preannotations_from_folder_to_project` _method_
16+
`SAClient.copy_image` _method_
17+
###
318
## 4.4.5 - October 23, 2022
419
### Added
520
- `SAClient.add_items_to_subset` _method_ to associate given items with a Subset.

README.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.rst

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
SuperAnnotate Python SDK
2+
===============================
3+
|Python| |License| |Changelog|
4+
5+
6+
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.
7+
8+
.. |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
9+
:target: https://pypi.org/project/superannotate/
10+
:alt: Python Versions
11+
.. |License| image:: https://img.shields.io/static/v1?label=license&message=MIT&color=green&style=flat-square
12+
:target: https://github.com/superannotateai/superannotate-python-sdk/blob/master/LICENSE/
13+
:alt: License
14+
.. |Changelog| image:: https://img.shields.io/static/v1?label=change&message=log&color=yellow&style=flat-square
15+
:target: https://github.com/superannotateai/superannotate-python-sdk/blob/master/CHANGELOG.md
16+
:alt: Changelog
17+
18+
Resources
19+
---------------
20+
21+
- API Reference and User Guide available on `Read the Docs <https://superannotate.readthedocs.io/en/stable/superannotate.sdk.html>`__
22+
- `Platform documentation <https://doc.superannotate.com/>`__
23+
24+
25+
Authentication
26+
---------------
27+
28+
.. code-block:: python
29+
30+
>>> from superannotate import SAClient
31+
# by environment variable SA_TOKEN
32+
>>> sa_client = SAClient()
33+
# by token
34+
>>> sa_client = SAClient(token='<team token>')
35+
# by config file
36+
# default path is ~/.superannotate/config.json
37+
>>> sa_client = SAClient(config_path='~/.superannotate/dev_config.json')
38+
39+
Using superannotate
40+
-------------------
41+
42+
.. code-block:: python
43+
44+
>>> from superannotate import SAClient
45+
>>> sa_client =SAClient()
46+
>>> project = 'Dogs'
47+
>>> sa_client.create_project(
48+
project_name=project,
49+
project_description='Test project generated via SDK',
50+
project_type='Vector'
51+
)
52+
>>> sa_client.create_annotation_class(
53+
project=project,
54+
name='dog',
55+
color='#F9E0FA',
56+
class_type='tag'
57+
)
58+
>>> sa_client.attach_items(
59+
project=project,
60+
attachments=[
61+
{
62+
'url': 'https://drive.google.com/uc?export=download&id=1ipOrZNSTlPUkI_hnrW9aUD5yULqqq5Vl',
63+
'name': 'dog.jpeg'
64+
}
65+
]
66+
)
67+
>>> sa_client.upload_annotations(
68+
project=project,
69+
annotations=[
70+
{
71+
'metadata': {'name': 'dog.jpeg'},
72+
'instances': [
73+
{'type': 'tag', 'className': 'dog'}
74+
]
75+
}
76+
]
77+
)
78+
>>> sa_client.get_annotations(project=project, items=['dog.jpeg'])
79+
80+
Installation
81+
------------
82+
83+
SuperAnnotate python SDK is available on PyPI:
84+
85+
.. code-block:: bash
86+
87+
pip install superannotate
88+
89+
90+
The package officially supports Python 3.7+ and was tested under Linux and
91+
Windows (`Anaconda <https://www.anaconda.com/products/individual#windows>`__
92+
) platforms.
93+
94+
For more detailed installation steps and package usage please have a look at the `tutorial <https://superannotate.readthedocs.io/en/stable/tutorial.sdk.html>`__
95+
96+
97+
Supported Features
98+
------------------
99+
100+
- search/get/create/clone/update/delete projects
101+
- search/get/create/delete folders
102+
- assign folders to project contributors
103+
- upload items to a project from a local or AWS S3 folder
104+
- attach items by URL or from an integrated storage, meanwhile keeping them secure in your cloud provider
105+
- get integrated cloud storages
106+
- upload annotations (also from local or AWS S3 folder)
107+
- delete annotations
108+
- set items annotations statuses
109+
- get/download/export annotations from a project (also to a local or AWS S3 folder)
110+
- invite/search team contributors or add contributors to a specific project
111+
- search/get/copy/move items in a project
112+
- query items using SA Query Language
113+
- define custom metadata for items and upload custom values (query based on your custom metadata)
114+
- upload priority scores
115+
- get available subsets (sets of segregated items), query items in a subset or add items to a subset
116+
- assign or anassign items to project contributors
117+
- download an image that has been uploaded to project
118+
- search/create/download/delete project annotation classes
119+
- search/download models
120+
- run predictions
121+
- convert annotations from/to COCO format
122+
- convert annotation from VOC, SuperVisely, LabelBox, DataLoop, VGG, VoTT, SageMaker, GoogleCloud, YOLO formats
123+
- CLI commands for simple tasks
124+
125+
Questions and Issues
126+
--------------------
127+
128+
For questions and issues please use this repo’s issue tracker on GitHub or contact support@superannotate.com.

docs/source/superannotate.sdk.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ ________
4242
.. automethod:: superannotate.SAClient.upload_videos_from_folder_to_project
4343
.. _ref_upload_annotations_from_folder_to_project:
4444
.. automethod:: superannotate.SAClient.upload_annotations_from_folder_to_project
45-
.. automethod:: superannotate.SAClient.upload_preannotations_from_folder_to_project
4645
.. automethod:: superannotate.SAClient.add_contributors_to_project
4746
.. automethod:: superannotate.SAClient.get_project_settings
4847
.. automethod:: superannotate.SAClient.set_project_default_image_quality_in_editor
@@ -107,7 +106,6 @@ ______
107106
.. automethod:: superannotate.SAClient.download_image
108107
.. automethod:: superannotate.SAClient.download_image_annotations
109108
.. automethod:: superannotate.SAClient.upload_image_annotations
110-
.. automethod:: superannotate.SAClient.copy_image
111109
.. automethod:: superannotate.SAClient.pin_image
112110
.. automethod:: superannotate.SAClient.add_annotation_bbox_to_image
113111
.. automethod:: superannotate.SAClient.add_annotation_point_to_image

setup.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ def get_version():
1717
with open("requirements.txt") as f:
1818
requirements.extend(f.read().splitlines())
1919

20-
with open('README.md') as f:
21-
readme = f.read()
22-
23-
readme = "\n".join(readme.split('\n')[2:])
2420

2521
setup(
2622
name='superannotate',
@@ -31,12 +27,12 @@ def get_version():
3127
description='Python SDK to SuperAnnotate platform',
3228
license='MIT',
3329
author='SuperAnnotate AI',
30+
author_email='suppoort@superannotate.com',
3431
url='https://github.com/superannotateai/superannotate-python-sdk',
35-
long_description=readme,
36-
long_description_content_type='text/markdown',
32+
long_description=open('README.rst').read(),
33+
long_description_content_type='text/x-rst',
3734
install_requires=requirements,
3835
setup_requires=['wheel'],
39-
description_file="README.md",
4036
entry_points={
4137
'console_scripts': ['superannotatecli = superannotate.lib.app.bin.superannotate:main']
4238
},

src/superannotate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33

44

5-
__version__ = "4.4.5"
5+
__version__ = "4.4.6b2"
66

77

88
sys.path.append(os.path.split(os.path.realpath(__file__))[0])

src/superannotate/lib/app/analytics/aggregators.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class DataAggregator:
9191
"polygon": lambda annotation: annotation["points"],
9292
"polyline": lambda annotation: annotation["points"],
9393
"cuboid": lambda annotation: annotation["points"],
94+
"comment": lambda annotation: annotation["points"],
9495
"point": lambda annotation: {"x": annotation["x"], "y": annotation["y"]},
9596
"annotation_type": lambda annotation: dict(
9697
cx=annotation["cx"],
@@ -123,7 +124,7 @@ def annotation_suffix(self):
123124
self._annotation_suffix = PIXEL_ANNOTATION_POSTFIX
124125
else:
125126
self._annotation_suffix = ATTACHED_VIDEO_ANNOTATION_POSTFIX
126-
return self._annotation_suffix
127+
return ATTACHED_VIDEO_ANNOTATION_POSTFIX
127128

128129
def get_annotation_paths(self):
129130
annotations_paths = []
@@ -378,7 +379,7 @@ def __append_annotation(annotation_dict):
378379

379380
for annotation_path in annotations_paths:
380381
annotation_json = json.load(open(annotation_path))
381-
parts = annotation_path.name.split(self.annotation_suffix)
382+
parts = Path(annotation_path).name.split(self.annotation_suffix)
382383
if len(parts) != 2:
383384
continue
384385
image_name = parts[0]
@@ -449,8 +450,8 @@ def __append_annotation(annotation_dict):
449450
attributes = annotation.get("attributes")
450451
user_metadata = self.__get_user_metadata(annotation)
451452
folder_name = None
452-
if annotation_path.parent != Path(self.project_root):
453-
folder_name = annotation_path.parent.name
453+
if Path(annotation_path).parent != Path(self.project_root):
454+
folder_name = Path(annotation_path).parent.name
454455
num_added = 0
455456
if not attributes:
456457
annotation_dict = {

src/superannotate/lib/app/interface/cli_interface.py

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,6 @@ def export_project(
129129
)
130130
sys.exit(0)
131131

132-
def upload_preannotations(
133-
self, project, folder, dataset_name=None, task=None, format=None
134-
):
135-
"""
136-
To upload preannotations from folder to project use
137-
Optional argument format accepts input annotation format. It can have COCO or SuperAnnotate values.
138-
If the argument is not given then SuperAnnotate (the native annotation format) is assumed.
139-
Only when COCO format is specified dataset-name and task arguments are required.
140-
dataset-name specifies JSON filename (without extension) in <folder_path>.
141-
task specifies the COCO task for conversion. Please see import_annotation_format for more details.
142-
"""
143-
self._upload_annotations(
144-
project=project,
145-
folder=folder,
146-
format=format,
147-
dataset_name=dataset_name,
148-
task=task,
149-
pre=True,
150-
)
151-
sys.exit(0)
152-
153132
def upload_annotations(
154133
self, project, folder, dataset_name=None, task=None, format=None
155134
):
@@ -167,13 +146,10 @@ def upload_annotations(
167146
format=format,
168147
dataset_name=dataset_name,
169148
task=task,
170-
pre=False,
171149
)
172150
sys.exit(0)
173151

174-
def _upload_annotations(
175-
self, project, folder, format, dataset_name, task, pre=True
176-
):
152+
def _upload_annotations(self, project, folder, format, dataset_name, task):
177153
project_folder_name = project
178154
project_name, folder_name = split_project_path(project)
179155
project = SAClient().controller.get_project(project_name)
@@ -197,14 +173,10 @@ def _upload_annotations(
197173
task=task,
198174
)
199175
annotations_path = temp_dir
200-
if pre:
201-
SAClient().upload_preannotations_from_folder_to_project(
202-
project_folder_name, annotations_path
203-
)
204-
else:
205-
SAClient().upload_annotations_from_folder_to_project(
206-
project_folder_name, annotations_path
207-
)
176+
177+
SAClient().upload_annotations_from_folder_to_project(
178+
project_folder_name, annotations_path
179+
)
208180
sys.exit(0)
209181

210182
def attach_image_urls(

0 commit comments

Comments
 (0)