|
12 | 12 | },
|
13 | 13 | {
|
14 | 14 | "cell_type": "code",
|
15 |
| - "execution_count": 1, |
| 15 | + "execution_count": null, |
16 | 16 | "id": "danish-compatibility",
|
17 | 17 | "metadata": {},
|
18 | 18 | "outputs": [],
|
19 | 19 | "source": [
|
20 |
| - "!pip labelbox[data] == 3.0b0" |
| 20 | + "!pip install \"labelbox[data]==3.0.0rc1\"" |
21 | 21 | ]
|
22 | 22 | },
|
23 | 23 | {
|
24 | 24 | "cell_type": "code",
|
25 |
| - "execution_count": 2, |
| 25 | + "execution_count": null, |
26 | 26 | "id": "honey-elevation",
|
27 | 27 | "metadata": {},
|
28 | 28 | "outputs": [],
|
|
39 | 39 | },
|
40 | 40 | {
|
41 | 41 | "cell_type": "code",
|
42 |
| - "execution_count": 3, |
| 42 | + "execution_count": null, |
43 | 43 | "id": "committed-richards",
|
44 | 44 | "metadata": {},
|
45 | 45 | "outputs": [],
|
|
75 | 75 | },
|
76 | 76 | {
|
77 | 77 | "cell_type": "code",
|
78 |
| - "execution_count": 4, |
| 78 | + "execution_count": null, |
79 | 79 | "id": "hydraulic-paradise",
|
80 | 80 | "metadata": {},
|
81 | 81 | "outputs": [],
|
|
96 | 96 | },
|
97 | 97 | {
|
98 | 98 | "cell_type": "code",
|
99 |
| - "execution_count": 5, |
| 99 | + "execution_count": null, |
100 | 100 | "id": "exclusive-elephant",
|
101 | 101 | "metadata": {},
|
102 | 102 | "outputs": [],
|
|
109 | 109 | },
|
110 | 110 | {
|
111 | 111 | "cell_type": "code",
|
112 |
| - "execution_count": 6, |
| 112 | + "execution_count": null, |
113 | 113 | "id": "polyphonic-consensus",
|
114 | 114 | "metadata": {},
|
115 | 115 | "outputs": [],
|
|
119 | 119 | },
|
120 | 120 | {
|
121 | 121 | "cell_type": "code",
|
122 |
| - "execution_count": 7, |
| 122 | + "execution_count": null, |
123 | 123 | "id": "emotional-origin",
|
124 | 124 | "metadata": {},
|
125 |
| - "outputs": [ |
126 |
| - { |
127 |
| - "name": "stdout", |
128 |
| - "output_type": "stream", |
129 |
| - "text": [ |
130 |
| - "WARNING:tensorflow:From ../model_assisted_labeling/image_model.py:17: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.\n", |
131 |
| - "Instructions for updating:\n", |
132 |
| - "This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.\n", |
133 |
| - "INFO:tensorflow:Restoring parameters from gs://cloud-tpu-checkpoints/mask-rcnn/1555659850/variables/variables\n" |
134 |
| - ] |
135 |
| - } |
136 |
| - ], |
| 125 | + "outputs": [], |
137 | 126 | "source": [
|
138 | 127 | "#Downloads weights and loads the model.\n",
|
139 | 128 | "load_model()"
|
|
152 | 141 | },
|
153 | 142 | {
|
154 | 143 | "cell_type": "code",
|
155 |
| - "execution_count": 8, |
| 144 | + "execution_count": null, |
156 | 145 | "id": "interested-joyce",
|
157 | 146 | "metadata": {},
|
158 | 147 | "outputs": [],
|
|
196 | 185 | },
|
197 | 186 | {
|
198 | 187 | "cell_type": "code",
|
199 |
| - "execution_count": 9, |
| 188 | + "execution_count": null, |
200 | 189 | "id": "interstate-louisiana",
|
201 | 190 | "metadata": {},
|
202 | 191 | "outputs": [],
|
203 | 192 | "source": [
|
204 |
| - "### We can just start creating predictions whether or not we have a \n", |
| 193 | + "# We can just start creating predictions whether or not we have a configured project in labelbox\n", |
205 | 194 | "image_urls = ['https://raw.githubusercontent.com/Labelbox/labelbox-python/develop/examples/assets/2560px-Kitano_Street_Kobe01s5s4110.jpg']\n",
|
206 | 195 | "\n",
|
207 |
| - "labellist = LabelList([])\n", |
208 |
| - "\n", |
| 196 | + "labellist = LabelList()\n", |
209 | 197 | "for image_url in image_urls:\n",
|
210 | 198 | " image_data = RasterData(url = image_url)\n",
|
211 | 199 | " height, width = image_data.data.shape[:2]\n",
|
|
230 | 218 | },
|
231 | 219 | {
|
232 | 220 | "cell_type": "code",
|
233 |
| - "execution_count": 10, |
| 221 | + "execution_count": null, |
234 | 222 | "id": "modern-program",
|
235 | 223 | "metadata": {},
|
236 |
| - "outputs": [ |
237 |
| - { |
238 |
| - "data": { |
239 |
| - "text/plain": [ |
240 |
| - "True" |
241 |
| - ] |
242 |
| - }, |
243 |
| - "execution_count": 10, |
244 |
| - "metadata": {}, |
245 |
| - "output_type": "execute_result" |
246 |
| - } |
247 |
| - ], |
| 224 | + "outputs": [], |
248 | 225 | "source": [
|
249 | 226 | "# Lets setup a project to label\n",
|
250 | 227 | "# Note see Ontology, Project, and Project_setup notebooks for more information on this section.\n",
|
|
263 | 240 | "id": "mechanical-functionality",
|
264 | 241 | "metadata": {},
|
265 | 242 | "source": [
|
266 |
| - "## Add ids required for MAL\n", |
267 |
| - "* Use helper functions to add urls to images and seg masks, assign schema ids to features, and add all data rows to the dataset." |
| 243 | + "## Prepare for upload\n", |
| 244 | + "* Our local annotations need the following:\n", |
| 245 | + " 1. signed url for segmentation masks\n", |
| 246 | + " 2. data rows in labelbox\n", |
| 247 | + " 3. feature schema ids" |
268 | 248 | ]
|
269 | 249 | },
|
270 | 250 | {
|
271 | 251 | "cell_type": "code",
|
272 |
| - "execution_count": 11, |
| 252 | + "execution_count": null, |
273 | 253 | "id": "vietnamese-kingdom",
|
274 | 254 | "metadata": {},
|
275 |
| - "outputs": [ |
276 |
| - { |
277 |
| - "name": "stderr", |
278 |
| - "output_type": "stream", |
279 |
| - "text": [ |
280 |
| - "1it [00:02, 2.06s/it]\n", |
281 |
| - "1it [00:00, 11366.68it/s]\n", |
282 |
| - "1it [00:00, 9020.01it/s]\n" |
283 |
| - ] |
284 |
| - }, |
285 |
| - { |
286 |
| - "data": { |
287 |
| - "text/plain": [ |
288 |
| - "<labelbox.data.annotation_types.collection.LabelList at 0x18855b040>" |
289 |
| - ] |
290 |
| - }, |
291 |
| - "execution_count": 11, |
292 |
| - "metadata": {}, |
293 |
| - "output_type": "execute_result" |
294 |
| - } |
295 |
| - ], |
| 255 | + "outputs": [], |
296 | 256 | "source": [
|
297 | 257 | "signer = lambda _bytes: client.upload_data(content=_bytes, sign=True)\n",
|
298 | 258 | "labellist.add_url_to_masks(signer) \\\n",
|
|
313 | 273 | },
|
314 | 274 | {
|
315 | 275 | "cell_type": "code",
|
316 |
| - "execution_count": 12, |
| 276 | + "execution_count": null, |
317 | 277 | "id": "multiple-values",
|
318 | 278 | "metadata": {},
|
319 |
| - "outputs": [ |
320 |
| - { |
321 |
| - "name": "stdout", |
322 |
| - "output_type": "stream", |
323 |
| - "text": [ |
324 |
| - "{'uuid': '2f708795-c8bf-4793-88d6-18ab57193466', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'schemaId': 'ckros4zfh2jjq0z8b6jq8h8u5', 'classifications': [{'schemaId': 'ckros4zg72jjw0z8ba10r0ozr', 'answer': {'schemaId': 'ckros4zgx2jjy0z8bbyuv6z1o'}}], 'bbox': {'top': 1352.3682861328125, 'left': 2275.82861328125, 'height': 350.1317138671875, 'width': 139.7919921875}}\n" |
325 |
| - ] |
326 |
| - } |
327 |
| - ], |
| 279 | + "outputs": [], |
328 | 280 | "source": [
|
329 | 281 | "ndjsons = list(NDJsonConverter.serialize(labellist))\n",
|
330 | 282 | "print(ndjsons[0])"
|
|
340 | 292 | },
|
341 | 293 | {
|
342 | 294 | "cell_type": "code",
|
343 |
| - "execution_count": 13, |
| 295 | + "execution_count": null, |
344 | 296 | "id": "deluxe-behavior",
|
345 | 297 | "metadata": {},
|
346 | 298 | "outputs": [],
|
|
354 | 306 | },
|
355 | 307 | {
|
356 | 308 | "cell_type": "code",
|
357 |
| - "execution_count": 14, |
| 309 | + "execution_count": null, |
358 | 310 | "id": "clean-friday",
|
359 | 311 | "metadata": {},
|
360 |
| - "outputs": [ |
361 |
| - { |
362 |
| - "name": "stdout", |
363 |
| - "output_type": "stream", |
364 |
| - "text": [ |
365 |
| - "{'uuid': '2f708795-c8bf-4793-88d6-18ab57193466', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
366 |
| - "{'uuid': '383e8da0-ae5d-47d8-8a13-767a03270d40', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
367 |
| - "{'uuid': 'e66676df-eba3-4231-82c7-5870f4e587be', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
368 |
| - "{'uuid': 'ba1e748b-3bcc-41f1-b5d6-f7c420c95b14', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
369 |
| - "{'uuid': '4ce19f3a-7d81-420c-a830-47eda0034fc7', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
370 |
| - "{'uuid': '3491fa2f-39cb-4582-b2e4-c7196a3bb37e', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
371 |
| - "{'uuid': '97d17219-9f3e-4c6e-af7a-0c263445405b', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
372 |
| - "{'uuid': 'b829c83b-8741-4ea4-9f98-0478fdde2bf0', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
373 |
| - "{'uuid': '36747eee-714e-424d-a9ff-65951f32c15c', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
374 |
| - "{'uuid': '68889fc5-2f10-4929-8c7b-8e4301cf17bf', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
375 |
| - "{'uuid': 'b7a6025d-fd8a-46e8-a24d-2340be021d69', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
376 |
| - "{'uuid': 'e8a46ebc-30ac-41bd-b0b9-042b99774dc3', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
377 |
| - "{'uuid': 'ba1d40b9-eb6d-4eae-babc-08e14b76eedc', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
378 |
| - "{'uuid': 'd81bea0a-baf1-4a70-902c-e2f251cb82d2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
379 |
| - "{'uuid': '9bf9337f-1550-4dc8-b969-f9c294a44355', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
380 |
| - "{'uuid': '0dd0d47e-f512-46c2-a670-62044085b01b', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
381 |
| - "{'uuid': '7196cc1d-b8e5-4ad3-bc28-d33c83dbd8c2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
382 |
| - "{'uuid': '51e67fba-d5f2-44b1-835a-71d66365411c', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
383 |
| - "{'uuid': '90d8e3e9-5184-4500-8b9c-dc690e20e6e9', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
384 |
| - "{'uuid': 'ed2f9581-5dc7-4748-ab1e-28c85b601ba5', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
385 |
| - "{'uuid': '7ba3b5b6-3ec3-4fe5-ba7a-bc6edf017af7', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
386 |
| - "{'uuid': '72555669-9899-4e5f-a683-f7676aa9ac4a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
387 |
| - "{'uuid': 'b0cbc556-ce6b-459f-9420-f1146c97a944', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
388 |
| - "{'uuid': '1f17e1c1-9b48-4638-9bdc-3f62a1cba83e', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
389 |
| - "{'uuid': 'a9e2340c-22d2-4469-bffe-1a546816b621', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
390 |
| - "{'uuid': '4772a3df-8072-4e33-a6c9-36e94470a8b2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
391 |
| - "{'uuid': '40302e2c-d8ae-41b8-8069-86e62dfff3d4', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
392 |
| - "{'uuid': '892aa14a-7b37-4f23-a014-20f37b45c17a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
393 |
| - "{'uuid': 'bc6a665f-95c2-450c-a2bb-d9578e8f5b5a', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
394 |
| - "{'uuid': 'eb2c61a4-fce8-400e-b981-19f03b5a38ed', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
395 |
| - "{'uuid': '3f22c739-33ff-4673-a7bb-953aed76e2b2', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
396 |
| - "{'uuid': '12eaaf77-d7e3-4375-bdc8-2e1588c718d5', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
397 |
| - "{'uuid': '0713fea3-d2e5-4ed4-b722-a6a65c19afc0', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
398 |
| - "{'uuid': '4a629d43-f576-4a7e-b64e-870d3309a98d', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
399 |
| - "{'uuid': '5010efef-e45f-4cbe-a92e-86a62962d6e9', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n", |
400 |
| - "{'uuid': '41ded899-3a7c-47a4-9e37-1362e5a8d486', 'dataRow': {'id': 'ckros561421gc0zu0eoae5ume'}, 'status': 'SUCCESS'}\n" |
401 |
| - ] |
402 |
| - } |
403 |
| - ], |
| 312 | + "outputs": [], |
404 | 313 | "source": [
|
405 | 314 | "# Review the upload status\n",
|
406 |
| - "for status in upload_task.statuses:\n", |
| 315 | + "for status in upload_task.statuses[:5]:\n", |
407 | 316 | " print(status)"
|
408 | 317 | ]
|
409 | 318 | },
|
|
418 | 327 | ],
|
419 | 328 | "metadata": {
|
420 | 329 | "kernelspec": {
|
421 |
| - "display_name": "Python 3", |
| 330 | + "display_name": "Python 3 (ipykernel)", |
422 | 331 | "language": "python",
|
423 | 332 | "name": "python3"
|
424 | 333 | },
|
|
0 commit comments