Skip to content

Commit 211b366

Browse files
committed
cleanup
1 parent 44dd0a3 commit 211b366

12 files changed

+516
-828
lines changed

notebooks/001_create_project.ipynb

+45-357
Large diffs are not rendered by default.

notebooks/003_upload_and_predict_image.ipynb

+33-33
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": null,
1514
"id": "bc86f115-d96c-463c-962d-6b50d88b330d",
1615
"metadata": {
1716
"pycharm": {
1817
"name": "#%%\n"
1918
}
2019
},
21-
"outputs": [],
2220
"source": [
2321
"# As usual we will connect to the platform first, using the server details from the .env file\n",
2422
"\n",
@@ -28,7 +26,9 @@
2826
"geti_server_configuration = get_server_details_from_env()\n",
2927
"\n",
3028
"geti = Geti(server_config=geti_server_configuration)"
31-
]
29+
],
30+
"outputs": [],
31+
"execution_count": null
3232
},
3333
{
3434
"cell_type": "markdown",
@@ -41,15 +41,15 @@
4141
},
4242
{
4343
"cell_type": "code",
44-
"execution_count": null,
4544
"id": "63108a6c-c99b-4be9-b4fc-eca5556756c6",
4645
"metadata": {},
47-
"outputs": [],
4846
"source": [
4947
"from geti_sdk.rest_clients import ImageClient, PredictionClient, ProjectClient\n",
5048
"\n",
5149
"project_client = ProjectClient(session=geti.session, workspace_id=geti.workspace_id)"
52-
]
50+
],
51+
"outputs": [],
52+
"execution_count": null
5353
},
5454
{
5555
"cell_type": "markdown",
@@ -61,13 +61,13 @@
6161
},
6262
{
6363
"cell_type": "code",
64-
"execution_count": null,
6564
"id": "5b2dbd9b-29b9-4000-8c55-cdb5cfd86463",
6665
"metadata": {},
67-
"outputs": [],
6866
"source": [
6967
"PROJECT_NAME = \"COCO animal detection demo\""
70-
]
68+
],
69+
"outputs": [],
70+
"execution_count": null
7171
},
7272
{
7373
"cell_type": "markdown",
@@ -79,10 +79,8 @@
7979
},
8080
{
8181
"cell_type": "code",
82-
"execution_count": null,
8382
"id": "059ff478-a5da-4363-a281-3ef5ad265151",
8483
"metadata": {},
85-
"outputs": [],
8684
"source": [
8785
"project = project_client.get_project(project_name=PROJECT_NAME)\n",
8886
"image_client = ImageClient(\n",
@@ -91,7 +89,9 @@
9189
"prediction_client = PredictionClient(\n",
9290
" session=geti.session, workspace_id=geti.workspace_id, project=project\n",
9391
")"
94-
]
92+
],
93+
"outputs": [],
94+
"execution_count": null
9595
},
9696
{
9797
"cell_type": "markdown",
@@ -104,14 +104,14 @@
104104
},
105105
{
106106
"cell_type": "code",
107-
"execution_count": null,
108107
"id": "2465640a-50ca-46cf-92bb-75dc29c65ab2",
109108
"metadata": {},
110-
"outputs": [],
111109
"source": [
112110
"images = image_client.get_all_images()\n",
113111
"print(f\"Project '{project.name}' contains {len(images)} images.\")"
114-
]
112+
],
113+
"outputs": [],
114+
"execution_count": null
115115
},
116116
{
117117
"cell_type": "markdown",
@@ -123,15 +123,15 @@
123123
},
124124
{
125125
"cell_type": "code",
126-
"execution_count": null,
127126
"id": "5113c81a-5e5f-4109-b781-b057bb7e674d",
128127
"metadata": {},
129-
"outputs": [],
130128
"source": [
131129
"from geti_sdk.demos import EXAMPLE_IMAGE_PATH\n",
132130
"\n",
133131
"image = image_client.upload_image(image=EXAMPLE_IMAGE_PATH)"
134-
]
132+
],
133+
"outputs": [],
134+
"execution_count": null
135135
},
136136
{
137137
"cell_type": "markdown",
@@ -143,14 +143,14 @@
143143
},
144144
{
145145
"cell_type": "code",
146-
"execution_count": null,
147146
"id": "a8ff33cf-f693-4c55-95bb-215e5065f99f",
148147
"metadata": {},
149-
"outputs": [],
150148
"source": [
151149
"images = image_client.get_all_images()\n",
152150
"print(f\"Project '{project.name}' contains {len(images)} images.\")"
153-
]
151+
],
152+
"outputs": [],
153+
"execution_count": null
154154
},
155155
{
156156
"cell_type": "markdown",
@@ -167,10 +167,8 @@
167167
},
168168
{
169169
"cell_type": "code",
170-
"execution_count": null,
171170
"id": "1b9fc8a2-8020-40ed-927c-ea124d698190",
172171
"metadata": {},
173-
"outputs": [],
174172
"source": [
175173
"from geti_sdk.demos import ensure_trained_example_project\n",
176174
"\n",
@@ -179,7 +177,9 @@
179177
"\n",
180178
"# Then, request the prediction\n",
181179
"prediction = prediction_client.get_image_prediction(image)"
182-
]
180+
],
181+
"outputs": [],
182+
"execution_count": null
183183
},
184184
{
185185
"cell_type": "markdown",
@@ -192,20 +192,18 @@
192192
},
193193
{
194194
"cell_type": "code",
195-
"execution_count": null,
196195
"id": "3ff32064-a90a-4de7-9bd7-4bc8f1377e6b",
197196
"metadata": {},
198-
"outputs": [],
199197
"source": [
200198
"print(prediction.overview)"
201-
]
199+
],
200+
"outputs": [],
201+
"execution_count": null
202202
},
203203
{
204204
"cell_type": "code",
205-
"execution_count": null,
206205
"id": "1affebae-88b4-46ac-97c5-e8373a880d74",
207206
"metadata": {},
208-
"outputs": [],
209207
"source": [
210208
"import cv2\n",
211209
"\n",
@@ -220,7 +218,9 @@
220218
"image_rgb = cv2.cvtColor(numpy_image, cv2.COLOR_BGR2RGB)\n",
221219
"result = visualizer.draw(image_rgb, prediction)\n",
222220
"visualizer.show_in_notebook(result)"
223-
]
221+
],
222+
"outputs": [],
223+
"execution_count": null
224224
},
225225
{
226226
"cell_type": "markdown",
@@ -233,10 +233,8 @@
233233
},
234234
{
235235
"cell_type": "code",
236-
"execution_count": null,
237236
"id": "1bb56cd8-35db-45f8-8b2f-64aa36caff1e",
238237
"metadata": {},
239-
"outputs": [],
240238
"source": [
241239
"quick_image, quick_prediction = geti.upload_and_predict_image(\n",
242240
" project=project,\n",
@@ -247,7 +245,9 @@
247245
"quick_image_rgb = cv2.cvtColor(quick_image.numpy, cv2.COLOR_BGR2RGB)\n",
248246
"quick_result = visualizer.draw(quick_image_rgb, quick_prediction)\n",
249247
"visualizer.show_in_notebook(quick_result)"
250-
]
248+
],
249+
"outputs": [],
250+
"execution_count": null
251251
}
252252
],
253253
"metadata": {

notebooks/004_create_pipeline_project_from_dataset.ipynb

+26-26
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": null,
1716
"id": "35717528-ee7e-41be-af63-7451e6c169f1",
1817
"metadata": {},
19-
"outputs": [],
2018
"source": [
2119
"# As usual we will connect to the platform first, using the server details from the .env file\n",
2220
"\n",
@@ -26,7 +24,9 @@
2624
"geti_server_configuration = get_server_details_from_env()\n",
2725
"\n",
2826
"geti = Geti(server_config=geti_server_configuration)"
29-
]
27+
],
28+
"outputs": [],
29+
"execution_count": null
3030
},
3131
{
3232
"cell_type": "markdown",
@@ -39,15 +39,15 @@
3939
},
4040
{
4141
"cell_type": "code",
42-
"execution_count": null,
4342
"id": "45ee2b8f-6f79-4916-857b-9af585848d21",
4443
"metadata": {},
45-
"outputs": [],
4644
"source": [
4745
"from geti_sdk.demos import get_coco_dataset\n",
4846
"\n",
4947
"COCO_PATH = get_coco_dataset(dataset_path=None)"
50-
]
48+
],
49+
"outputs": [],
50+
"execution_count": null
5151
},
5252
{
5353
"cell_type": "markdown",
@@ -60,10 +60,8 @@
6060
},
6161
{
6262
"cell_type": "code",
63-
"execution_count": null,
6463
"id": "25c1033b-2856-46c0-b513-7b41de0b128e",
6564
"metadata": {},
66-
"outputs": [],
6765
"source": [
6866
"from geti_sdk.annotation_readers import DatumAnnotationReader\n",
6967
"\n",
@@ -73,7 +71,9 @@
7371
"annotation_reader_task_2 = DatumAnnotationReader(\n",
7472
" base_data_folder=COCO_PATH, annotation_format=\"coco\"\n",
7573
")"
76-
]
74+
],
75+
"outputs": [],
76+
"execution_count": null
7777
},
7878
{
7979
"cell_type": "markdown",
@@ -90,14 +90,14 @@
9090
},
9191
{
9292
"cell_type": "code",
93-
"execution_count": null,
9493
"id": "58d7ab28-11e3-43bd-ba8a-cf111b9c209b",
9594
"metadata": {},
96-
"outputs": [],
9795
"source": [
9896
"domestic_animals = [\"dog\", \"cat\", \"horse\"]\n",
9997
"wild_animals = [\"elephant\", \"giraffe\"]"
100-
]
98+
],
99+
"outputs": [],
100+
"execution_count": null
101101
},
102102
{
103103
"cell_type": "markdown",
@@ -110,15 +110,15 @@
110110
},
111111
{
112112
"cell_type": "code",
113-
"execution_count": null,
114113
"id": "3b2b3428-b4c4-4421-83cb-0726502c9fcf",
115114
"metadata": {},
116-
"outputs": [],
117115
"source": [
118116
"all_labels = domestic_animals + wild_animals\n",
119117
"annotation_reader_task_1.filter_dataset(labels=all_labels, criterion=\"OR\")\n",
120118
"annotation_reader_task_1.group_labels(labels_to_group=all_labels, group_name=\"animal\")"
121-
]
119+
],
120+
"outputs": [],
121+
"execution_count": null
122122
},
123123
{
124124
"cell_type": "markdown",
@@ -131,17 +131,17 @@
131131
},
132132
{
133133
"cell_type": "code",
134-
"execution_count": null,
135134
"id": "4a7d6e23-799b-4e1c-9d0e-3c7f10812020",
136135
"metadata": {},
137-
"outputs": [],
138136
"source": [
139137
"annotation_reader_task_2.filter_dataset(labels=all_labels, criterion=\"OR\")\n",
140138
"annotation_reader_task_2.group_labels(\n",
141139
" labels_to_group=domestic_animals, group_name=\"domestic\"\n",
142140
")\n",
143141
"annotation_reader_task_2.group_labels(labels_to_group=wild_animals, group_name=\"wild\")"
144-
]
142+
],
143+
"outputs": [],
144+
"execution_count": null
145145
},
146146
{
147147
"cell_type": "markdown",
@@ -158,10 +158,8 @@
158158
},
159159
{
160160
"cell_type": "code",
161-
"execution_count": null,
162161
"id": "e73a6646-1b1d-4997-b986-c8f75bbe0c38",
163162
"metadata": {},
164-
"outputs": [],
165163
"source": [
166164
"PROJECT_NAME = \"COCO multitask animal demo\"\n",
167165
"PROJECT_TYPE = \"detection_to_classification\"\n",
@@ -175,7 +173,9 @@
175173
" number_of_images_to_annotate=90,\n",
176174
" enable_auto_train=True,\n",
177175
")"
178-
]
176+
],
177+
"outputs": [],
178+
"execution_count": null
179179
},
180180
{
181181
"cell_type": "markdown",
@@ -187,21 +187,21 @@
187187
},
188188
{
189189
"cell_type": "code",
190-
"execution_count": null,
191190
"id": "142e6932-0b3e-4a32-b5e2-bcc655dd807e",
192191
"metadata": {},
193-
"outputs": [],
194192
"source": [
195193
"print(project.summary)"
196-
]
194+
],
195+
"outputs": [],
196+
"execution_count": null
197197
},
198198
{
199199
"cell_type": "code",
200-
"execution_count": null,
201200
"id": "32050c75-56ec-4489-9a6d-7452a0d80345",
202201
"metadata": {},
202+
"source": [],
203203
"outputs": [],
204-
"source": []
204+
"execution_count": null
205205
}
206206
],
207207
"metadata": {

0 commit comments

Comments
 (0)