Skip to content

Commit 79164bd

Browse files
committed
2 parents fda7544 + 96a1368 commit 79164bd

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ __________________
8282
- Convert annotation format from/to COCO
8383
- Add annotations to local SuperAnnotate format JSONs
8484
- CLI commands for simple tasks
85+
- Aggregate class/attribute distribution as histogram
8586

8687
----------
8788

docs/source/superannotate.sdk.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,3 +330,8 @@ ____________________
330330
.. autofunction:: superannotate.add_annotation_template_to_json
331331
.. autofunction:: superannotate.add_annotation_cuboid_to_json
332332

333+
Aggregating class distribution from annotations
334+
_____________________________________________________________
335+
336+
.. autofunction:: superannotate.class_distribution
337+
.. autofunction:: superannotate.attribute_distribution

docs/source/tutorial.sdk.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,26 @@ project with the found contributor as an QA:
341341
.. code-block:: python
342342
343343
sa.share_project(project, "hovnatan@superannotate.com", user_role="QA")
344+
345+
Aggregating class distribution across multiple projects
346+
______________________________
347+
348+
After exporting annotations from multiple projects, it is possible to aggregate class distribution of annotated instances as follows
349+
350+
.. code-block:: python
351+
352+
df = sa.class_distribution("<path_to_export_folder>", [project_names])
353+
354+
Aggregated distribution is returned as pandas dataframe with columns class_name and count. Enabling visualize flag plots histogram of obtained distribution.
355+
356+
.. code-block:: python
357+
358+
df = sa.class_distribution("<path_to_export_folder>", [project_names], visualize = True)
359+
360+
Similarly aggregation of class attributes across multiple projects can be obtained with
361+
362+
.. code-block:: python
363+
364+
df = sa.attribute_distribution("<path_to_export_folder>", [project_names], visualize = True)
365+
366+
Here pandas dataframe with columns identifying attribute and corresponding instance count is returned. Within visualized histogram attributes of the same class are grouped by color and sorted accordingly.

superannotate/analytics/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def __append_annotation(annotation_dict):
9393
annotation_point_labels = annotation["pointLabels"
9494
] if vector and len(
9595
annotation["pointLabels"]
96-
) == 0 else None
96+
) != 0 else None
9797

9898
attributes = annotation["attributes"]
9999
if not attributes:

0 commit comments

Comments
 (0)