Skip to content

Commit 97bdd85

Browse files
authored
Merge pull request #232 from Labelbox/develop
3.0.0rc2
2 parents ea1b9b4 + 96325bc commit 97bdd85

33 files changed

+453
-371
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
# Version 3.0.0-rc2 (2021-08-09)
4+
## Updates
5+
* Rename `data` property of TextData, ImageData, and VideoData types to `value`.
6+
* Decrease wait time between updates for `BulkImportRequest.wait_until_done()`
7+
* Organization is no longer used to create the LFO in `Project.setup()`
8+
9+
310
# Version 3.0.0-rc1 (2021-08-05)
411
## Added
512
* Model diagnostics notebooks

examples/annotation_types/basics.ipynb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"metadata": {},
3434
"outputs": [],
3535
"source": [
36-
"!pip install \"labelbox[data]==3.0.0rc1\""
36+
"!pip install \"labelbox[data]\" --pre"
3737
]
3838
},
3939
{
@@ -55,7 +55,7 @@
5555
"source": [
5656
"from labelbox.data.annotation_types import (\n",
5757
" Label,\n",
58-
" RasterData,\n",
58+
" ImageData,\n",
5959
" LabelList,\n",
6060
" TextData,\n",
6161
" VideoData,\n",
@@ -176,7 +176,7 @@
176176
"outputs": [],
177177
"source": [
178178
"labels = [Label(\n",
179-
" data = RasterData(url = \"http://my-img.jpg\"),\n",
179+
" data = ImageData(url = \"http://my-img.jpg\"),\n",
180180
" annotations = [\n",
181181
" ObjectAnnotation(\n",
182182
" value = Point(x = 10, y = 10),\n",
@@ -215,7 +215,7 @@
215215
"* There are three classes to represent data\n",
216216
" * TextData\n",
217217
" * VideoData\n",
218-
" * RasterData\n",
218+
" * ImageData\n",
219219
"* The data objects can be constructed from various representations\n",
220220
" - remote (url, uri)\n",
221221
" - disk ( file path)\n",
@@ -229,7 +229,7 @@
229229
"id": "associate-cutting",
230230
"metadata": {},
231231
"source": [
232-
"### RasterData"
232+
"### ImageData"
233233
]
234234
},
235235
{
@@ -240,13 +240,13 @@
240240
"outputs": [],
241241
"source": [
242242
"# Data can be instantiated with any of the following\n",
243-
"image = RasterData(im_bytes = b'bytes')\n",
244-
"image = RasterData(arr = np.zeros((10,10,3)).astype(np.uint8))\n",
245-
"image = RasterData(file_path = '/tmp/img.jpg')\n",
243+
"image = ImageData(im_bytes = b'bytes')\n",
244+
"image = ImageData(arr = np.zeros((10,10,3)).astype(np.uint8))\n",
245+
"image = ImageData(file_path = '/tmp/img.jpg')\n",
246246
"image_url = \"https://picsum.photos/id/1003/200/300\"\n",
247-
"image = RasterData(url = image_url)\n",
247+
"image = ImageData(url = image_url)\n",
248248
"# All of these can access the numpy representation the same way:\n",
249-
"np_data = image.data\n",
249+
"np_data = image.value\n",
250250
"\n",
251251
"\n",
252252
"im = Image.fromarray(np_data)\n",
@@ -273,7 +273,7 @@
273273
"text = TextData(text = \" some text content...\")\n",
274274
"text = TextData(url = \"https://filesamples.com/samples/document/txt/sample3.txt\")\n",
275275
"\n",
276-
"print(text.data[:100])"
276+
"print(text.value[:100])"
277277
]
278278
},
279279
{
@@ -306,7 +306,7 @@
306306
"outputs": [],
307307
"source": [
308308
"\n",
309-
"for idx, frame in video.data:\n",
309+
"for idx, frame in video.value:\n",
310310
" # Show every 50th frame\n",
311311
" if idx % 50 == 0:\n",
312312
" video_im = Image.fromarray(frame)\n",
@@ -342,7 +342,7 @@
342342
"outputs": [],
343343
"source": [
344344
"td = TextData(text = \"some text\", uid = \"ckrey6o07000008l50uk2gcr3\", external_id = \"my_text_data_row\")\n",
345-
"rd = RasterData(url = image_url, uid = \"ckrey7te2000108l5hl8564dr\", external_id = \"my_raster_data_row\")\n",
345+
"rd = ImageData(url = image_url, uid = \"ckrey7te2000108l5hl8564dr\", external_id = \"my_raster_data_row\")\n",
346346
"vd = VideoData(url = video_url, uid = \"ckrey7xef000208l57hwfgi3v\", external_id = \"my_video_data_row\")"
347347
]
348348
},
@@ -539,7 +539,7 @@
539539
"metadata": {},
540540
"source": [
541541
"##### Mask\n",
542-
"* The mask can be any RasterData object.\n"
542+
"* The mask can be any ImageData object.\n"
543543
]
544544
},
545545
{
@@ -551,12 +551,12 @@
551551
"source": [
552552
"\n",
553553
"mask_annotation = ObjectAnnotation(\n",
554-
" value = Mask(mask = RasterData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
554+
" value = Mask(mask = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
555555
" name = \"mask class name\"\n",
556556
")\n",
557557
"\n",
558558
"mask_annotation = ObjectAnnotation(\n",
559-
" value = Mask(mask = RasterData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
559+
" value = Mask(mask = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8)), color = (255,255,255)),\n",
560560
" schema_id = \"ckrgcel71000008jtd9mn0szu\"\n",
561561
")"
562562
]
@@ -577,7 +577,7 @@
577577
"metadata": {},
578578
"outputs": [],
579579
"source": [
580-
"raster_data = RasterData(arr = np.zeros((32,32,3), dtype = np.uint8))\n",
580+
"raster_data = ImageData(arr = np.zeros((32,32,3), dtype = np.uint8))\n",
581581
"mask_annotation = ObjectAnnotation(\n",
582582
" value = Mask(mask = raster_data, color = [255,255,255]),\n",
583583
" name = \"eyes\"\n",
@@ -604,7 +604,7 @@
604604
"metadata": {},
605605
"outputs": [],
606606
"source": [
607-
"raster_data = RasterData(arr = np.zeros((32,32, 3), dtype = np.uint8))\n",
607+
"raster_data = ImageData(arr = np.zeros((32,32, 3), dtype = np.uint8))\n",
608608
"mask_annotation = ObjectAnnotation(\n",
609609
" value = Mask(mask = raster_data, color = (128,255,255)),\n",
610610
" name = \"eye\"\n",
@@ -734,7 +734,7 @@
734734
"outputs": [],
735735
"source": [
736736
"mask_annotation = Mask(\n",
737-
" mask = RasterData(arr = np_mask),\n",
737+
" mask = ImageData(arr = np_mask),\n",
738738
" color = color \n",
739739
")\n",
740740
"\n",
@@ -790,7 +790,7 @@
790790
"metadata": {},
791791
"outputs": [],
792792
"source": [
793-
"mask_data = RasterData(arr = np_seg_mask)\n",
793+
"mask_data = ImageData(arr = np_seg_mask)\n",
794794
"eye_mask = Mask(mask = mask_data, color = eye_color)\n",
795795
"nose_mask = Mask(mask = mask_data, color = nose_color)\n"
796796
]
@@ -946,15 +946,15 @@
946946
"outputs": [],
947947
"source": [
948948
"label = Label(\n",
949-
" data = RasterData(url = image_url),\n",
949+
" data = ImageData(url = image_url),\n",
950950
" annotations = [\n",
951951
" ObjectAnnotation(\n",
952952
" value = Polygon(points = [Point(x = x, y = y) for x,y in xy_poly]),\n",
953953
" name = \"deer\"\n",
954954
" ),\n",
955955
" ObjectAnnotation(\n",
956956
" name = \"deer_eyes\",\n",
957-
" value = Mask(mask = RasterData(arr = np_mask), color = color)\n",
957+
" value = Mask(mask = ImageData(arr = np_mask), color = color)\n",
958958
" )\n",
959959
" ]\n",
960960
")"
@@ -994,7 +994,7 @@
994994
"outputs": [],
995995
"source": [
996996
"# Manually set just by adding a value:\n",
997-
"image = RasterData(arr = np_data)\n",
997+
"image = ImageData(arr = np_data)\n",
998998
"image.url = \"http://myurl\""
999999
]
10001000
},
@@ -1048,7 +1048,7 @@
10481048
"source": [
10491049
"\n",
10501050
"label = Label(\n",
1051-
" data = RasterData(arr = np_data),\n",
1051+
" data = ImageData(arr = np_data),\n",
10521052
" annotations = [\n",
10531053
" ObjectAnnotation(\n",
10541054
" name = \"deer_nose\",\n",

examples/annotation_types/converters.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
28-
"!pip install \"labelbox[data]==3.0.0rc1\""
28+
"!pip install \"labelbox[data]\" --pre"
2929
]
3030
},
3131
{
@@ -361,7 +361,7 @@
361361
"\n",
362362
"for label in labels:\n",
363363
" annotation_lookup = label.frame_annotations()\n",
364-
" for idx, frame in label.data.data:\n",
364+
" for idx, frame in label.data.value:\n",
365365
" if idx % 30 != 1:\n",
366366
" continue\n",
367367
" \n",
@@ -412,7 +412,7 @@
412412
}
413413
],
414414
"source": [
415-
"im_data = label_list[0].data.data\n",
415+
"im_data = label_list[0].data.value\n",
416416
"h,w = im_data.shape[:2]\n",
417417
"Image.fromarray(im_data)"
418418
]

examples/annotation_types/label_containers.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"!pip install \"labelbox[data]==3.0.0rc1\""
23+
"!pip install \"labelbox[data]\" --pre"
2424
]
2525
},
2626
{
@@ -36,7 +36,7 @@
3636
"from labelbox import LabelingFrontend\n",
3737
"from labelbox.data.annotation_types import (\n",
3838
" Label, \n",
39-
" RasterData, \n",
39+
" ImageData, \n",
4040
" Mask, \n",
4141
" Point, \n",
4242
" Polygon, \n",
@@ -136,9 +136,9 @@
136136
" Point(x = 99, y = 181).raster(im_h, im_w, thickness = 3),\n",
137137
" ]\n",
138138
" mask_arr = np.max([*eye_masks,nose_mask] , axis = 0)\n",
139-
" mask = RasterData(arr = mask_arr)\n",
139+
" mask = ImageData(arr = mask_arr)\n",
140140
" return [Label(\n",
141-
" data = RasterData(im_bytes = requests.get(image_url).content),\n",
141+
" data = ImageData(im_bytes = requests.get(image_url).content),\n",
142142
" annotations = [\n",
143143
" ObjectAnnotation(value = get_polygon(),name = \"deer\"),\n",
144144
" ObjectAnnotation(name = \"deer_eyes\", value = Mask(mask = mask, color = eye_color)), \n",

examples/annotation_types/mal_using_annotation_types.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"!pip install \"labelbox[data]==3.0.0rc1\""
20+
"!pip install \"labelbox[data]\" --pre"
2121
]
2222
},
2323
{
@@ -66,7 +66,7 @@
6666
"\n",
6767
"from labelbox.data.annotation_types import (\n",
6868
" LabelList,\n",
69-
" RasterData,\n",
69+
" ImageData,\n",
7070
" Rectangle,\n",
7171
" ObjectAnnotation,\n",
7272
" ClassificationAnnotation,\n",
@@ -170,7 +170,7 @@
170170
" start = Point(x = box[1], y = box[0]), end = Point(x = box[3], y = box[2])\n",
171171
" )\n",
172172
" elif name == 'car':\n",
173-
" value = Mask(mask = RasterData.from_2D_arr(arr = seg), color = (1,1,1))\n",
173+
" value = Mask(mask = ImageData.from_2D_arr(arr = seg), color = (1,1,1))\n",
174174
" if value is not None:\n",
175175
" annotations.append(\n",
176176
" ObjectAnnotation(\n",
@@ -202,8 +202,8 @@
202202
"\n",
203203
"labellist = LabelList()\n",
204204
"for image_url in image_urls:\n",
205-
" image_data = RasterData(url = image_url)\n",
206-
" height, width = image_data.data.shape[:2]\n",
205+
" image_data = ImageData(url = image_url)\n",
206+
" height, width = image_data.value.shape[:2]\n",
207207
" prediction = predict(np.array([image_data.im_bytes]), min_score=0.5, height=height, width = width)\n",
208208
" annotations = get_annotations(prediction['boxes'], prediction['class_indices'], prediction['seg_masks'])\n",
209209
" update_bag_classifications(annotations)\n",

examples/basics/data_rows.ipynb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@
180180
"id": "successful-patch",
181181
"metadata": {},
182182
"source": [
183-
"### Create"
183+
"### Create\n",
184+
"* Create a single data row at a time"
184185
]
185186
},
186187
{
@@ -201,7 +202,6 @@
201202
}
202203
],
203204
"source": [
204-
"#Add one at a time\n",
205205
"dataset = client.create_dataset(name=\"testing-dataset\")\n",
206206
"dataset.create_data_row(row_data=\"https://picsum.photos/200/300\")\n",
207207
"\n",
@@ -211,14 +211,21 @@
211211
" external_id=str(uuid.uuid4()))"
212212
]
213213
},
214+
{
215+
"cell_type": "markdown",
216+
"id": "helpful-lingerie",
217+
"metadata": {},
218+
"source": [
219+
"* Bulk create data rows (This is much faster than creating individual data rows)"
220+
]
221+
},
214222
{
215223
"cell_type": "code",
216224
"execution_count": 10,
217225
"id": "round-perfume",
218226
"metadata": {},
219227
"outputs": [],
220228
"source": [
221-
"# Bulk create data_rows\n",
222229
"task1 = dataset.create_data_rows([{\n",
223230
" DataRow.row_data: \"https://picsum.photos/200/300\"\n",
224231
"}, {\n",
@@ -382,7 +389,7 @@
382389
],
383390
"metadata": {
384391
"kernelspec": {
385-
"display_name": "Python 3",
392+
"display_name": "Python 3 (ipykernel)",
386393
"language": "python",
387394
"name": "python3"
388395
},

0 commit comments

Comments
 (0)