Skip to content

Commit 7913876

Browse files
committed
Improve docs
1 parent ff54fc7 commit 7913876

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ all: coverage tests
99
$(PYTHON) setup.py build_ext --inplace
1010

1111
tests:
12-
$(PYTESTS) -n 8
12+
$(PYTESTS) -n auto
1313

1414
stress-tests: SA_STRESS_TESTS=1
1515
stress-tests: tests
16-
$(PYTESTS) -n 8
16+
$(PYTESTS) -n auto
1717

1818
clean:
1919
rm -rf superannotate.egg-info
@@ -24,7 +24,7 @@ clean:
2424
coverage: test_coverage
2525

2626
test_coverage:
27-
-$(PYTESTS) --cov=superannotate -n 8
27+
-$(PYTESTS) --cov=superannotate -n auto
2828
$(COVERAGE) html
2929
@echo "\033[95m\n\nCoverage successful! View the output at file://htmlcov/index.html.\n\033[0m"
3030

superannotate/analytics/common.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010

1111
def df_to_annotations(df, output_dir):
12-
"""Converts and saves pandas DataFrame annotation info (see aggregate_annotations_as_df) in output_dir
13-
The DataFrame should have columns: "imageName", "className", "attributeGroupName", "attributeName", "type", "error", "locked", "visible", trackingId", "probability", "pointLabels", "meta", "commentResolved", "classColor", "groupId"
12+
"""Converts and saves pandas DataFrame annotation info (see aggregate_annotations_as_df)
13+
in output_dir.
14+
The DataFrame should have columns: "imageName", "className", "attributeGroupName",
15+
"attributeName", "type", "error", "locked", "visible", trackingId", "probability",
16+
"pointLabels", "meta", "commentResolved", "classColor", "groupId"
1417
1518
Currently only works for Vector projects.
1619
@@ -145,12 +148,21 @@ def aggregate_annotations_as_df(
145148
146149
:param project_root: export path of the project
147150
:type project_root: Pathlike (str or Path)
148-
:param include_classes_wo_annotations: enables inclusion of classes info that have no instances in annotations
151+
:param include_classes_wo_annotations: enables inclusion of classes info
152+
that have no instances in annotations
149153
:type include_classes_wo_annotations: bool
150154
:param include_comments: enables inclusion of comments info as commentResolved column
151155
:type include_comments: bool
152-
153-
:return: DataFrame on annotations with columns: "imageName", "instanceId" className", "attributeGroupName", "attributeName", "type", "error", "locked", "visible", "trackingId", "probability", "pointLabels", "meta" (geometry information as string), "commentResolved", "classColor", "groupId", "imageWidth", "imageHeight", "imageStatus", "imagePinned", "createdAt", "creatorRole", "creationType", "creatorEmail", "updatedAt", "updatorRole", "updatorEmail"
156+
:param include_tags: enables inclusion of tags info as tag column
157+
:type include_tags: bool
158+
159+
:return: DataFrame on annotations with columns: "imageName", "instanceId",
160+
"className", "attributeGroupName", "attributeName", "type", "error", "locked",
161+
"visible", "trackingId", "probability", "pointLabels",
162+
"meta" (geometry information as string), "commentResolved", "classColor",
163+
"groupId", "imageWidth", "imageHeight", "imageStatus", "imagePinned",
164+
"createdAt", "creatorRole", "creationType", "creatorEmail", "updatedAt",
165+
"updatorRole", "updatorEmail", "tag"
154166
:rtype: pandas DataFrame
155167
"""
156168

tests/test_filter_instances.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def test_filter_instances(tmpdir):
110110
# project = sa.create_project(PROJECT_NAME_1, "test", "Vector")
111111

112112
not_filtered = sa.aggregate_annotations_as_df(PROJECT_DIR)
113+
print(not_filtered["className"].unique())
113114

114115
filtered_excl = sa.filter_annotation_instances(
115116
not_filtered,
@@ -119,6 +120,7 @@ def test_filter_instances(tmpdir):
119120
"className": "Human"
120121
}]
121122
)
123+
print(filtered_excl["className"].unique())
122124

123125
filtered_incl = sa.filter_annotation_instances(
124126
not_filtered,
@@ -128,6 +130,7 @@ def test_filter_instances(tmpdir):
128130
"className": "Plant"
129131
}]
130132
)
133+
print(filtered_incl["className"].unique())
131134

132135
assert filtered_incl.equals(filtered_excl)
133136

0 commit comments

Comments
 (0)