Skip to content

Commit 492f9ed

Browse files
committed
Rebase
1 parent 2ef2b2f commit 492f9ed

File tree

9 files changed

+1350
-146
lines changed

9 files changed

+1350
-146
lines changed

‎examples/criteria1_partial_faces.ipynb‎

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
"outputs": [],
9797
"source": [
9898
"chosen_idx = 4\n",
99-
"facial_part = FacialParts.upper_half\n",
99+
"facial_part = FacialParts.UPPER_HALF.value\n",
100100
"cropped_ds = CroppedDataLoader(ds, facial_part, crop_img=False)\n",
101101
"image, picked_landmarks, meta = cropped_ds[chosen_idx]"
102102
]
@@ -159,7 +159,7 @@
159159
" <p>Description: Mean of normalised mean Euclidean distances across images</p>\n",
160160
" <p>Metric: <b>0.0623</b> (threshold = 1)</p>\n",
161161
" \n",
162-
" <p>Prediction time: 53.02 s.</p>\n",
162+
" <p>Prediction time: 20.22 s.</p>\n",
163163
" "
164164
],
165165
"text/plain": [
@@ -168,7 +168,7 @@
168168
" Description: Mean of normalised mean Euclidean distances across images\n",
169169
" Metric: 0.0623 (threshold = 1)\n",
170170
" \n",
171-
" Prediction time: 53.02 s.\n",
171+
" Prediction time: 20.22 s.\n",
172172
" "
173173
]
174174
},
@@ -385,20 +385,20 @@
385385
"data": {
386386
"text/html": [
387387
"\n",
388-
" <h4><span style=\"color:red;\">𐄂</span> Test \"NME_mean\" failed</h4>\n",
388+
" <h4><span style=\"color:green;\"></span> Test \"NME_mean\" succeeded</h4>\n",
389389
" <p>Description: Mean of normalised mean Euclidean distances across images</p>\n",
390-
" <p>Metric: <b>1.3379</b> (threshold = 1)</p>\n",
390+
" <p>Metric: <b>0.5723</b> (threshold = 1)</p>\n",
391391
" \n",
392-
" <p>Prediction time: 1.07 s.</p>\n",
392+
" <p>Prediction time: 0.69 s.</p>\n",
393393
" "
394394
],
395395
"text/plain": [
396396
"\n",
397-
" Test \"NME_mean\" failed\n",
397+
" Test \"NME_mean\" succeeded\n",
398398
" Description: Mean of normalised mean Euclidean distances across images\n",
399-
" Metric: 1.3379 (threshold = 1)\n",
399+
" Metric: 0.5723 (threshold = 1)\n",
400400
" \n",
401-
" Prediction time: 1.07 s.\n",
401+
" Prediction time: 0.69 s.\n",
402402
" "
403403
]
404404
},
@@ -423,20 +423,20 @@
423423
"data": {
424424
"text/html": [
425425
"\n",
426-
" <h4><span style=\"color:red;\">𐄂</span> Test \"NME_std\" failed</h4>\n",
426+
" <h4><span style=\"color:green;\"></span> Test \"NME_std\" succeeded</h4>\n",
427427
" <p>Description: Standard deviation of normalised Mean Euclidean distances across images</p>\n",
428-
" <p>Metric: <b>2.6256</b> (threshold = 1)</p>\n",
428+
" <p>Metric: <b>0.7242</b> (threshold = 1)</p>\n",
429429
" \n",
430-
" <p>Prediction time: 1.06 s.</p>\n",
430+
" <p>Prediction time: 0.66 s.</p>\n",
431431
" "
432432
],
433433
"text/plain": [
434434
"\n",
435-
" Test \"NME_std\" failed\n",
435+
" Test \"NME_std\" succeeded\n",
436436
" Description: Standard deviation of normalised Mean Euclidean distances across images\n",
437-
" Metric: 2.6256 (threshold = 1)\n",
437+
" Metric: 0.7242 (threshold = 1)\n",
438438
" \n",
439-
" Prediction time: 1.06 s.\n",
439+
" Prediction time: 0.66 s.\n",
440440
" "
441441
]
442442
},
@@ -448,13 +448,6 @@
448448
"source": [
449449
"TestDiff(NMEStd, threshold=1).run(model, ds, CroppedDataLoader(ds, part=facial_part, margins=0.01))"
450450
]
451-
},
452-
{
453-
"cell_type": "code",
454-
"execution_count": null,
455-
"metadata": {},
456-
"outputs": [],
457-
"source": []
458451
}
459452
],
460453
"metadata": {

‎examples/ex1_draw_landmarks.ipynb‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
"name": "stdout",
192192
"output_type": "stream",
193193
"text": [
194-
"left eye\n",
194+
"FacialParts.LEFT_EYE\n",
195195
"NMEMean:0.03064837061887285\n",
196196
"NMEs:[0.03639644 0.02607136 0.02883627 0.02288638 0.0390514 ]\n",
197197
"MEMean:6.205209482416183\n",
@@ -262,10 +262,10 @@
262262
}
263263
],
264264
"source": [
265-
"prediction = model.predict(ds, facial_part=FacialParts.left_eye)\n",
265+
"prediction = model.predict(ds, facial_part=FacialParts.LEFT_EYE.value)\n",
266266
"marks = ds.all_marks\n",
267267
"\n",
268-
"print(FacialParts.left_eye.name)\n",
268+
"print(FacialParts.LEFT_EYE)\n",
269269
"for metric in [NMEMean, NMEs, MEMean, MEStd, NMEMean, NMEStd, Es]:\n",
270270
" print(f\"{metric.__name__}:{metric.get(prediction, marks)}\")"
271271
]
@@ -313,13 +313,6 @@
313313
"source": [
314314
"draw_marks(image, [ground_truth_landmarks, loreal_landmarks], [\"green\", \"red\"])"
315315
]
316-
},
317-
{
318-
"cell_type": "code",
319-
"execution_count": null,
320-
"metadata": {},
321-
"outputs": [],
322-
"source": []
323316
}
324317
],
325318
"metadata": {

‎examples/ex2_draw_partial_landmarks.ipynb‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"from loreal_poc.marks.facial_parts import FacialParts\n",
8282
"\n",
8383
"chosen_idx = 4\n",
84-
"facial_parts = FacialParts.right_eye + FacialParts.right_eyebrow\n",
84+
"facial_parts = FacialParts.RIGHT_EYE.value + FacialParts.RIGHT_EYEBROW.value\n",
8585
"\n",
8686
"cropped_ds = CroppedDataLoader(ds, facial_parts, crop_img=False)\n",
8787
"\n",
@@ -114,6 +114,30 @@
114114
"draw_marks(image, [picked_landmarks], [\"green\"])"
115115
]
116116
},
117+
{
118+
"cell_type": "code",
119+
"execution_count": 5,
120+
"metadata": {},
121+
"outputs": [
122+
{
123+
"name": "stdout",
124+
"output_type": "stream",
125+
"text": [
126+
"FacialPart(name='(right eye + right eyebrow)', idx=array([False, False, False, False, False, False, False, False, False,\n",
127+
" False, False, False, False, False, False, False, False, False,\n",
128+
" False, False, False, False, True, True, True, True, True,\n",
129+
" False, False, False, False, False, False, False, False, False,\n",
130+
" False, False, False, False, False, False, True, True, True,\n",
131+
" True, True, True, False, False, False, False, False, False,\n",
132+
" False, False, False, False, False, False, False, False, False,\n",
133+
" False, False, False, False, False]))\n"
134+
]
135+
}
136+
],
137+
"source": [
138+
"print(facial_parts)"
139+
]
140+
},
117141
{
118142
"cell_type": "code",
119143
"execution_count": null,

‎examples/ex4_tests_and_metrics.ipynb‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
},
101101
{
102102
"cell_type": "code",
103-
"execution_count": 6,
103+
"execution_count": 5,
104104
"metadata": {
105105
"collapsed": false,
106106
"jupyter": {
@@ -116,7 +116,7 @@
116116
" <p>Description: Mean of normalised mean Euclidean distances across images</p>\n",
117117
" <p>Metric: <b>0.0623</b> (threshold = 1)</p>\n",
118118
" \n",
119-
" <p>Prediction time: 20.18 s.</p>\n",
119+
" <p>Prediction time: 20.02 s.</p>\n",
120120
" "
121121
],
122122
"text/plain": [
@@ -125,11 +125,11 @@
125125
" Description: Mean of normalised mean Euclidean distances across images\n",
126126
" Metric: 0.0623 (threshold = 1)\n",
127127
" \n",
128-
" Prediction time: 20.18 s.\n",
128+
" Prediction time: 20.02 s.\n",
129129
" "
130130
]
131131
},
132-
"execution_count": 6,
132+
"execution_count": 5,
133133
"metadata": {},
134134
"output_type": "execute_result"
135135
}
@@ -140,7 +140,7 @@
140140
},
141141
{
142142
"cell_type": "code",
143-
"execution_count": 8,
143+
"execution_count": 6,
144144
"metadata": {},
145145
"outputs": [
146146
{
@@ -159,22 +159,22 @@
159159
"\n",
160160
" <h4><span style=\"color:green;\">✓</span> Test \"NME_mean\" succeeded</h4>\n",
161161
" <p>Description: Mean of normalised mean Euclidean distances across images</p>\n",
162-
" <p>Metric: <b>0.6372</b> (threshold = 1)</p>\n",
162+
" <p>Metric: <b>0.3962</b> (threshold = 1)</p>\n",
163163
" Prediction fail rate: 0.4\n",
164-
" <p>Prediction time: 0.94 s.</p>\n",
164+
" <p>Prediction time: 0.69 s.</p>\n",
165165
" "
166166
],
167167
"text/plain": [
168168
"\n",
169169
" Test \"NME_mean\" succeeded\n",
170170
" Description: Mean of normalised mean Euclidean distances across images\n",
171-
" Metric: 0.6372 (threshold = 1)\n",
171+
" Metric: 0.3962 (threshold = 1)\n",
172172
" Prediction fail rate: 0.4\n",
173-
" Prediction time: 0.94 s.\n",
173+
" Prediction time: 0.69 s.\n",
174174
" "
175175
]
176176
},
177-
"execution_count": 8,
177+
"execution_count": 6,
178178
"metadata": {},
179179
"output_type": "execute_result"
180180
}
@@ -183,7 +183,7 @@
183183
"from loreal_poc.marks.facial_parts import FacialParts\n",
184184
"from loreal_poc.dataloaders.wrappers import CroppedDataLoader, CachedDataLoader\n",
185185
"\n",
186-
"facial_part = FacialParts.left_half\n",
186+
"facial_part = FacialParts.LEFT_HALF.value\n",
187187
"\n",
188188
"TestDiff(metric=NMEMean, threshold=1).run(model, ds, CroppedDataLoader(ds, part=facial_part), facial_part=facial_part)"
189189
]

0 commit comments

Comments
 (0)