Skip to content

Commit 0389152

Browse files
author
Matt Sokoloff
committed
wip notebooks
1 parent b40f48c commit 0389152

File tree

5 files changed

+544
-592
lines changed

5 files changed

+544
-592
lines changed

examples/annotation_types/annotation_type_basics.ipynb

Lines changed: 517 additions & 576 deletions
Large diffs are not rendered by default.

examples/annotation_types/converters.ipynb

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "adjacent-confidentiality",
5+
"id": "unable-plaintiff",
66
"metadata": {},
77
"source": [
88
"# Converters\n",
@@ -28,7 +28,7 @@
2828
{
2929
"cell_type": "code",
3030
"execution_count": 34,
31-
"id": "strategic-swift",
31+
"id": "supreme-louisiana",
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [
@@ -45,7 +45,7 @@
4545
},
4646
{
4747
"cell_type": "markdown",
48-
"id": "familiar-details",
48+
"id": "ideal-aruba",
4949
"metadata": {},
5050
"source": [
5151
"## Labelbox V1 Converter\n",
@@ -55,7 +55,7 @@
5555
},
5656
{
5757
"cell_type": "markdown",
58-
"id": "silent-plumbing",
58+
"id": "interesting-wholesale",
5959
"metadata": {},
6060
"source": [
6161
"### Video"
@@ -64,7 +64,7 @@
6464
{
6565
"cell_type": "code",
6666
"execution_count": 35,
67-
"id": "corporate-porcelain",
67+
"id": "charged-edmonton",
6868
"metadata": {},
6969
"outputs": [
7070
{
@@ -130,13 +130,15 @@
130130
" if idx % 20 != 0:\n",
131131
" continue\n",
132132
" \n",
133+
" # TODO: Draw annotations...\n",
134+
" \n",
133135
" im = Image.fromarray(frame)\n",
134136
" IPython.display.display( im.resize((w//2, h//2) )) "
135137
]
136138
},
137139
{
138140
"cell_type": "markdown",
139-
"id": "complimentary-county",
141+
"id": "julian-algebra",
140142
"metadata": {},
141143
"source": [
142144
"### Image"
@@ -145,7 +147,7 @@
145147
{
146148
"cell_type": "code",
147149
"execution_count": 36,
148-
"id": "tired-candy",
150+
"id": "static-bradford",
149151
"metadata": {},
150152
"outputs": [
151153
{
@@ -165,7 +167,7 @@
165167
{
166168
"cell_type": "code",
167169
"execution_count": 37,
168-
"id": "fantastic-transmission",
170+
"id": "imported-pension",
169171
"metadata": {},
170172
"outputs": [
171173
{
@@ -189,7 +191,7 @@
189191
{
190192
"cell_type": "code",
191193
"execution_count": 38,
192-
"id": "labeled-douglas",
194+
"id": "abstract-samba",
193195
"metadata": {},
194196
"outputs": [
195197
{
@@ -216,7 +218,7 @@
216218
{
217219
"cell_type": "code",
218220
"execution_count": 39,
219-
"id": "arabic-elements",
221+
"id": "developmental-explorer",
220222
"metadata": {},
221223
"outputs": [
222224
{
@@ -245,7 +247,7 @@
245247
{
246248
"cell_type": "code",
247249
"execution_count": 45,
248-
"id": "genuine-expression",
250+
"id": "composed-yacht",
249251
"metadata": {},
250252
"outputs": [
251253
{
@@ -264,7 +266,7 @@
264266
},
265267
{
266268
"cell_type": "markdown",
267-
"id": "careful-profile",
269+
"id": "pleased-claim",
268270
"metadata": {},
269271
"source": [
270272
"## NDJson Converter\n",
@@ -275,7 +277,7 @@
275277
{
276278
"cell_type": "code",
277279
"execution_count": 53,
278-
"id": "located-aquarium",
280+
"id": "small-treasure",
279281
"metadata": {},
280282
"outputs": [
281283
{
@@ -301,7 +303,7 @@
301303
{
302304
"cell_type": "code",
303305
"execution_count": 56,
304-
"id": "scenic-quebec",
306+
"id": "wrapped-money",
305307
"metadata": {},
306308
"outputs": [
307309
{
@@ -322,7 +324,7 @@
322324
},
323325
{
324326
"cell_type": "markdown",
325-
"id": "refined-lying",
327+
"id": "hundred-pavilion",
326328
"metadata": {},
327329
"source": [
328330
"* See how this is used in the MAL notebooks"
@@ -331,7 +333,7 @@
331333
{
332334
"cell_type": "code",
333335
"execution_count": null,
334-
"id": "recognized-roman",
336+
"id": "broadband-mount",
335337
"metadata": {},
336338
"outputs": [],
337339
"source": []

labelbox/data/annotation_types/data/raster.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ def data(self) -> np.ndarray:
7272
else:
7373
raise ValueError("Must set either url, file_path or im_bytes")
7474

75+
def set_fetch_fn(self, fn):
76+
object.__setattr__(self, 'fetch_remote', lambda: fn(self))
77+
7578
def fetch_remote(self) -> bytes:
7679
"""
7780
Method for accessing url.

labelbox/data/annotation_types/data/text.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def data(self) -> str:
3636
else:
3737
raise ValueError("Must set either url, file_path or im_bytes")
3838

39+
def set_fetch_fn(self, fn):
40+
object.__setattr__(self, 'fetch_remote', lambda: fn(self))
41+
3942
def fetch_remote(self) -> str:
4043
"""
4144
Method for accessing url.

labelbox/data/annotation_types/data/video.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def __getitem__(self, idx: int) -> np.ndarray:
8686
)
8787
return self.frames[idx]
8888

89+
def set_fetch_fn(self, fn):
90+
object.__setattr__(self, 'fetch_remote', lambda: fn(self))
91+
8992
def fetch_remote(self, local_path) -> None:
9093
"""
9194
Method for downloading data from self.url

0 commit comments

Comments
 (0)