Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HT-7839] Z Index Bug Fix #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion hasty/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def _batch_create(requester, project_id, image_id, labels):
"bbox": label.get("bbox"),
"polygon": label.get("polygon"),
"mask": label.get("mask"),
"z_index": label.get("z_index"),
"z_index": label.get("z_index", 0),
"external_id": label.get("external_id"),
"tool_used": C_LABELS_TOOL_USED})
res = requester.post(Label.endpoint_image.format(project_id=project_id, image_id=image_id), json_data=data)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ def test_label(self):
labels = self.image.get_labels()
self.assertEqual(0, len(labels))

def test_labels(self):
labels = self.image.get_labels()
self.assertEqual(0, len(labels))
# Label with specified z_index
bbox1 = [10, 10, 50, 50]
poly1 = [[10, 20], [20, 44], [10, 15]]
z_index1 = 3
# Label with unspecified z_index
bbox2 = [10, 10, 50, 50]
poly2 = [[10, 20], [20, 44], [10, 15]]
z_index2 = None
# Bulk create labels
_ = self.image.create_labels(
{"class_id": self.label_class.id, "bbox": bbox1, "polygon": poly1, "mask": None, "z_index": z_index1},
{"class_id": self.label_class.id, "bbox": bbox2, "polygon": poly2, "mask": None, "z_index": z_index2}
)
labels = self.image.get_labels()
self.assertEqual(2, len(labels))
for label in labels:
label.delete()
labels = self.image.get_labels()
self.assertEqual(0, len(labels))

def test_external_id_for_label(self):
# Create label
bbox = [10, 10, 50, 50]
Expand Down
Loading