Skip to content

Commit d5249a7

Browse files
author
Matt Sokoloff
committed
data -> value
1 parent 71d3643 commit d5249a7

File tree

11 files changed

+22
-22
lines changed

11 files changed

+22
-22
lines changed

examples/annotation_types/basics.ipynb

Lines changed: 4 additions & 4 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]==3.0.0rc2\""
3737
]
3838
},
3939
{
@@ -246,7 +246,7 @@
246246
"image_url = \"https://picsum.photos/id/1003/200/300\"\n",
247247
"image = RasterData(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",

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]==3.0.0rc2\""
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: 1 addition & 1 deletion
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]==3.0.0rc2\""
2424
]
2525
},
2626
{

examples/annotation_types/mal_using_annotation_types.ipynb

Lines changed: 2 additions & 2 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]==3.0.0rc2\""
2121
]
2222
},
2323
{
@@ -203,7 +203,7 @@
203203
"labellist = LabelList()\n",
204204
"for image_url in image_urls:\n",
205205
" image_data = RasterData(url = image_url)\n",
206-
" height, width = image_data.data.shape[:2]\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/model_diagnostics/model_diagnostics_demo.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
"outputs": [],
7575
"source": [
76-
"!pip install \"labelbox[data]==3.0.0rc1\" \\\n",
76+
"!pip install \"labelbox[data]==3.0.0rc2\" \\\n",
7777
" scikit-image \\\n",
7878
" tensorflow"
7979
]
@@ -254,7 +254,7 @@
254254
"predictions = LabelList()\n",
255255
"for (image_url, external_id) in notebook.tqdm(image_data):\n",
256256
" image = RasterData(url = image_url, external_id = external_id)\n",
257-
" height, width = image.data.shape[:2]\n",
257+
" height, width = image.value.shape[:2]\n",
258258
" prediction = predict(np.array([image.im_bytes]), min_score=0.5, height=height, width = width)\n",
259259
" boxes, classes, seg_masks = prediction[\"boxes\"], prediction[\"class_indices\"], prediction[\"seg_masks\"]\n",
260260
" annotations = []\n",

examples/model_diagnostics/model_diagnostics_guide.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
},
8989
"outputs": [],
9090
"source": [
91-
"!pip install \"labelbox[data]==3.0.0rc1\""
91+
"!pip install \"labelbox[data]==3.0.0rc2\""
9292
]
9393
},
9494
{
@@ -258,7 +258,7 @@
258258
" \n",
259259
" # Build a list of annotation objects from your model inferences\n",
260260
" # image.data is just the numpy array representation of the image\n",
261-
" prediction = model.predict(image.data)\n",
261+
" prediction = model.predict(image.value)\n",
262262
" # Iterate of segmentation channels or instances depending on your model architecture ( or both )\n",
263263
" for instance, (xmin, ymin, xmax, ymax), seg, class_idx in prediction:\n",
264264
" class_name = class_names.get(class_idx)\n",

labelbox/data/annotation_types/data/raster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def np_to_bytes(self, arr: np.ndarray) -> bytes:
5959
return im_bytes.getvalue()
6060

6161
@property
62-
def data(self) -> np.ndarray:
62+
def value(self) -> np.ndarray:
6363
"""
6464
Property that unifies the data access pattern for all references to the raster.
6565

labelbox/data/annotation_types/data/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TextData(BaseData):
1616
url: Optional[str] = None
1717

1818
@property
19-
def data(self) -> str:
19+
def value(self) -> str:
2020
"""
2121
Property that unifies the data access pattern for all references to the text.
2222

labelbox/data/annotation_types/data/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def load_frames(self, overwrite: bool = False) -> None:
4141
self.frames[count] = frame
4242

4343
@property
44-
def data(self):
44+
def value(self):
4545
return self.frame_generator()
4646

4747
def frame_generator(

tests/data/annotation_types/data/test_raster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ def test_im_bytes():
1919
im_bytes = BytesIO()
2020
Image.fromarray(data).save(im_bytes, format="PNG")
2121
raster_data = RasterData(im_bytes=im_bytes.getvalue())
22-
data_ = raster_data.data
22+
data_ = raster_data.value
2323
assert np.all(data == data_)
2424

2525

2626
def test_im_url():
2727
raster_data = RasterData(url="https://picsum.photos/id/829/200/300")
28-
data_ = raster_data.data
28+
data_ = raster_data.value
2929
assert data_.shape == (300, 200, 3)
3030

3131

3232
def test_im_path():
3333
img_path = "/tmp/img.jpg"
3434
urllib.request.urlretrieve("https://picsum.photos/id/829/200/300", img_path)
3535
raster_data = RasterData(file_path=img_path)
36-
data_ = raster_data.data
36+
data_ = raster_data.value
3737
assert data_.shape == (300, 200, 3)
3838

3939

0 commit comments

Comments
 (0)