|
191 | 191 | " ]" |
192 | 192 | ] |
193 | 193 | }, |
194 | | - { |
195 | | - "cell_type": "code", |
196 | | - "execution_count": 7, |
197 | | - "id": "distant-republic", |
198 | | - "metadata": {}, |
199 | | - "outputs": [], |
200 | | - "source": [ |
201 | | - "def show_feature_schema_ids(label):\n", |
202 | | - " for annotation in label.annotations:\n", |
203 | | - " print(f\"Object : {annotation.name} - {annotation.feature_schema_id}\")\n", |
204 | | - " for classification in getattr(annotation, 'classifications', []):\n", |
205 | | - " print(\n", |
206 | | - " f\"--- Subclass : {classification.name} - {classification.feature_schema_id}\"\n", |
207 | | - " )\n", |
208 | | - " option = classification.value\n", |
209 | | - " print(\n", |
210 | | - " f\"--- --- Options: {option.answer.name} - {option.answer.feature_schema_id}\"\n", |
211 | | - " )\n", |
212 | | - "\n", |
213 | | - " if isinstance(annotation, ClassificationAnnotation):\n", |
214 | | - " for option in annotation.value.answer:\n", |
215 | | - " print(\n", |
216 | | - " f\"--- Options: {option.name} - {option.feature_schema_id}\")" |
217 | | - ] |
218 | | - }, |
219 | 194 | { |
220 | 195 | "cell_type": "code", |
221 | 196 | "execution_count": 8, |
|
271 | 246 | " print(annotation.value.mask.url)" |
272 | 247 | ] |
273 | 248 | }, |
274 | | - { |
275 | | - "cell_type": "code", |
276 | | - "execution_count": 10, |
277 | | - "id": "processed-exchange", |
278 | | - "metadata": {}, |
279 | | - "outputs": [], |
280 | | - "source": [ |
281 | | - "def show_references(label):\n", |
282 | | - " print('\\n--- schema ids ---\\n')\n", |
283 | | - " show_feature_schema_ids(label)\n", |
284 | | - " print(\"\\n--- mask urls ---\\n\")\n", |
285 | | - " print_mask_urls(label)\n", |
286 | | - " print('\\n--- image url ---\\n')\n", |
287 | | - " print(label.data.url)\n", |
288 | | - " print('\\n--- data row reference ---\\n')\n", |
289 | | - " print(original_label.data.uid)" |
290 | | - ] |
291 | | - }, |
292 | 249 | { |
293 | 250 | "cell_type": "markdown", |
294 | 251 | "id": "virtual-ocean", |
|
426 | 383 | "print(label_list[0].data.uid)" |
427 | 384 | ] |
428 | 385 | }, |
429 | | - { |
430 | | - "cell_type": "markdown", |
431 | | - "id": "vital-translation", |
432 | | - "metadata": {}, |
433 | | - "source": [ |
434 | | - "### Add schema ids" |
435 | | - ] |
436 | | - }, |
437 | | - { |
438 | | - "cell_type": "code", |
439 | | - "execution_count": 17, |
440 | | - "id": "quality-daughter", |
441 | | - "metadata": {}, |
442 | | - "outputs": [], |
443 | | - "source": [ |
444 | | - "for label in label_list:\n", |
445 | | - " show_feature_schema_ids(label)\n", |
446 | | - "# Note that this function will assign a uuid as the external id if it isn't provided.\n", |
447 | | - "label_list.assign_feature_schema_ids(ontology)\n", |
448 | | - "print('-' * 50)\n", |
449 | | - "for label in label_list:\n", |
450 | | - " show_feature_schema_ids(label)" |
451 | | - ] |
452 | | - }, |
453 | 386 | { |
454 | 387 | "cell_type": "code", |
455 | 388 | "execution_count": 18, |
|
547 | 480 | "show_references(original_label)\n", |
548 | 481 | "label_generator = LabelGenerator(labels) \\\n", |
549 | 482 | " .add_url_to_masks(signing_function) \\\n", |
550 | | - " .add_to_dataset(dataset, signing_function) \\\n", |
551 | | - " .assign_feature_schema_ids(ontology)" |
| 483 | + " .add_to_dataset(dataset, signing_function) " |
552 | 484 | ] |
553 | 485 | }, |
554 | 486 | { |
|
0 commit comments