Skip to content

Commit 10a1d2a

Browse files
author
Matt Sokoloff
committed
yapf
1 parent 54109a8 commit 10a1d2a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

examples/model_assisted_labeling/ndjson_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import uuid
99

1010

11-
def create_boxes_ndjson(datarow_id: str, schema_id: str, top: float, left: float,
12-
bottom: float, right: float) -> Dict[str, Any]:
11+
def create_boxes_ndjson(datarow_id: str, schema_id: str, top: float,
12+
left: float, bottom: float,
13+
right: float) -> Dict[str, Any]:
1314
"""
1415
* https://docs.labelbox.com/data-model/en/index-en#bounding-box
1516
@@ -64,8 +65,8 @@ def create_polygon_ndjson(datarow_id: str, schema_id: str,
6465

6566

6667
def create_mask_ndjson(client: Client, datarow_id: str, schema_id: str,
67-
segmentation_mask: np.ndarray, color: Tuple[int, int,
68-
int]) -> Dict[str, Any]:
68+
segmentation_mask: np.ndarray,
69+
color: Tuple[int, int, int]) -> Dict[str, Any]:
6970
"""
7071
Creates a mask for each object in the image
7172
* https://docs.labelbox.com/data-model/en/index-en#segmentation-mask
@@ -80,8 +81,8 @@ def create_mask_ndjson(client: Client, datarow_id: str, schema_id: str,
8081
ndjson representation of a segmentation mask
8182
"""
8283

83-
colorize = np.concatenate(([segmentation_mask[..., np.newaxis] * c for c in color]),
84-
axis=2)
84+
colorize = np.concatenate(
85+
([segmentation_mask[..., np.newaxis] * c for c in color]), axis=2)
8586
img_bytes = BytesIO()
8687
Image.fromarray(colorize).save(img_bytes, format="PNG")
8788
#* Use your own signed urls so that you can resign the data
@@ -100,8 +101,9 @@ def create_mask_ndjson(client: Client, datarow_id: str, schema_id: str,
100101
}
101102

102103

103-
def create_point_ndjson(datarow_id: str, schema_id: str, top: float, left: float,
104-
bottom: float, right: float) -> Dict[str, Any]:
104+
def create_point_ndjson(datarow_id: str, schema_id: str, top: float,
105+
left: float, bottom: float,
106+
right: float) -> Dict[str, Any]:
105107
"""
106108
* https://docs.labelbox.com/data-model/en/index-en#point
107109

0 commit comments

Comments
 (0)