Skip to content

Commit 9e418f9

Browse files
committed
more cleanup of assign feature schema ids
1 parent 0733ac4 commit 9e418f9

File tree

8 files changed

+144
-261
lines changed

8 files changed

+144
-261
lines changed

examples/annotation_types/basics.ipynb

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,8 +1147,7 @@
11471147
"source": [
11481148
"### Assigning Schema Ids:\n",
11491149
"* All tools, classifications, and options either have names or feature_schema_ids.\n",
1150-
"* Locally it is convenient to provide a name so that we don't need a labelbox project to use these interfaces.\n",
1151-
"* To use MAL and MEA schema ids are required"
1150+
"* Locally it is convenient to provide a name so that we don't need a labelbox project to use these interfaces."
11521151
]
11531152
},
11541153
{
@@ -1193,45 +1192,6 @@
11931192
"ontology = OntologyBuilder.from_project(project)"
11941193
]
11951194
},
1196-
{
1197-
"cell_type": "code",
1198-
"execution_count": 41,
1199-
"id": "phantom-offer",
1200-
"metadata": {},
1201-
"outputs": [],
1202-
"source": [
1203-
"def show_feature_schema_ids(label):\n",
1204-
" for annotation in label.annotations:\n",
1205-
" print(f\"Object : {annotation.name} - {annotation.feature_schema_id}\")\n",
1206-
" for classification in getattr(annotation, 'classifications', []):\n",
1207-
" print(\n",
1208-
" f\"--- Subclass : {classification.name} - {classification.feature_schema_id}\"\n",
1209-
" )\n",
1210-
" option = classification.value\n",
1211-
" print(\n",
1212-
" f\"--- --- Options: {option.answer.name} - {option.answer.feature_schema_id}\"\n",
1213-
" )\n",
1214-
"\n",
1215-
" if isinstance(annotation, ClassificationAnnotation):\n",
1216-
" for option in annotation.value.answer:\n",
1217-
" print(\n",
1218-
" f\"--- Options: {option.name} - {option.feature_schema_id}\")\n",
1219-
"\n",
1220-
"\n",
1221-
"show_feature_schema_ids(label)"
1222-
]
1223-
},
1224-
{
1225-
"cell_type": "code",
1226-
"execution_count": 42,
1227-
"id": "associate-lunch",
1228-
"metadata": {},
1229-
"outputs": [],
1230-
"source": [
1231-
"label.assign_feature_schema_ids(ontology)\n",
1232-
"show_feature_schema_ids(label)"
1233-
]
1234-
},
12351195
{
12361196
"cell_type": "markdown",
12371197
"id": "special-prerequisite",

examples/annotation_types/label_containers.ipynb

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -191,31 +191,6 @@
191191
" ]"
192192
]
193193
},
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-
},
219194
{
220195
"cell_type": "code",
221196
"execution_count": 8,
@@ -271,24 +246,6 @@
271246
" print(annotation.value.mask.url)"
272247
]
273248
},
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-
},
292249
{
293250
"cell_type": "markdown",
294251
"id": "virtual-ocean",
@@ -426,30 +383,6 @@
426383
"print(label_list[0].data.uid)"
427384
]
428385
},
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-
},
453386
{
454387
"cell_type": "code",
455388
"execution_count": 18,
@@ -547,8 +480,7 @@
547480
"show_references(original_label)\n",
548481
"label_generator = LabelGenerator(labels) \\\n",
549482
" .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) "
552484
]
553485
},
554486
{

0 commit comments

Comments
 (0)