8
8
import uuid
9
9
10
10
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 ]:
13
14
"""
14
15
* https://docs.labelbox.com/data-model/en/index-en#bounding-box
15
16
@@ -64,8 +65,8 @@ def create_polygon_ndjson(datarow_id: str, schema_id: str,
64
65
65
66
66
67
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 ]:
69
70
"""
70
71
Creates a mask for each object in the image
71
72
* 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,
80
81
ndjson representation of a segmentation mask
81
82
"""
82
83
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 )
85
86
img_bytes = BytesIO ()
86
87
Image .fromarray (colorize ).save (img_bytes , format = "PNG" )
87
88
#* 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,
100
101
}
101
102
102
103
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 ]:
105
107
"""
106
108
* https://docs.labelbox.com/data-model/en/index-en#point
107
109
0 commit comments