Skip to content
Snippets Groups Projects
Commit ebc1aa4a authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Use the same keypoint names as bob.ip.mtcnn (cafe implementation)

parent e7aa5899
No related branches found
No related tags found
1 merge request!12Add MTCNN (tensorflow) model
Pipeline #30177 passed
...@@ -93,7 +93,7 @@ class MTCNN: ...@@ -93,7 +93,7 @@ class MTCNN:
list list
A list of annotations. Annotations are dictionaries that contain the A list of annotations. Annotations are dictionaries that contain the
following keys: ``topleft``, ``bottomright``, ``reye``, ``leye``, ``nose``, following keys: ``topleft``, ``bottomright``, ``reye``, ``leye``, ``nose``,
``right_of_mouth``, ``left_of_mouth``, and ``quality``. ``mouthright``, ``mouthleft``, and ``quality``.
""" """
boxes, scores, landmarks = self.detect(img) boxes, scores, landmarks = self.detect(img)
annots = [] annots = []
...@@ -103,8 +103,8 @@ class MTCNN: ...@@ -103,8 +103,8 @@ class MTCNN:
right_eye = lm[0], lm[5] right_eye = lm[0], lm[5]
left_eye = lm[1], lm[6] left_eye = lm[1], lm[6]
nose = lm[2], lm[7] nose = lm[2], lm[7]
right_of_mouth = lm[3], lm[8] mouthright = lm[3], lm[8]
left_of_mouth = lm[4], lm[9] mouthleft = lm[4], lm[9]
annots.append( annots.append(
{ {
"topleft": topleft, "topleft": topleft,
...@@ -112,8 +112,8 @@ class MTCNN: ...@@ -112,8 +112,8 @@ class MTCNN:
"reye": right_eye, "reye": right_eye,
"leye": left_eye, "leye": left_eye,
"nose": nose, "nose": nose,
"right_of_mouth": right_of_mouth, "mouthright": mouthright,
"left_of_mouth": left_of_mouth, "mouthleft": mouthleft,
"quality": prob, "quality": prob,
} }
) )
......
...@@ -20,11 +20,11 @@ ...@@ -20,11 +20,11 @@
81.764984, 81.764984,
136.25734 136.25734
], ],
"right_of_mouth": [ "mouthright": [
88.05158, 88.05158,
128.52052 128.52052
], ],
"left_of_mouth": [ "mouthleft": [
84.64868, 84.64868,
150.7494 150.7494
], ],
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
71.690926, 71.690926,
454.36282 454.36282
], ],
"right_of_mouth": [ "mouthright": [
75.266556, 75.266556,
438.5781 438.5781
], ],
"left_of_mouth": [ "mouthleft": [
82.32741, 82.32741,
454.99423 454.99423
], ],
...@@ -82,11 +82,11 @@ ...@@ -82,11 +82,11 @@
104.02164, 104.02164,
56.380474 56.380474
], ],
"right_of_mouth": [ "mouthright": [
111.99057, 111.99057,
49.277725 49.277725
], ],
"left_of_mouth": [ "mouthleft": [
104.45787, 104.45787,
69.476105 69.476105
], ],
...@@ -113,11 +113,11 @@ ...@@ -113,11 +113,11 @@
138.73158, 138.73158,
257.6499 257.6499
], ],
"right_of_mouth": [ "mouthright": [
142.67319, 142.67319,
246.85234 246.85234
], ],
"left_of_mouth": [ "mouthleft": [
143.5627, 143.5627,
267.6805 267.6805
], ],
...@@ -144,11 +144,11 @@ ...@@ -144,11 +144,11 @@
86.6857, 86.6857,
344.3223 344.3223
], ],
"right_of_mouth": [ "mouthright": [
94.80564, 94.80564,
331.12646 331.12646
], ],
"left_of_mouth": [ "mouthleft": [
96.63391, 96.63391,
351.96518 351.96518
], ],
...@@ -175,11 +175,11 @@ ...@@ -175,11 +175,11 @@
151.32994, 151.32994,
182.92662 182.92662
], ],
"right_of_mouth": [ "mouthright": [
159.72272, 159.72272,
175.2344 175.2344
], ],
"left_of_mouth": [ "mouthleft": [
156.25536, 156.25536,
193.2938 193.2938
], ],
......
...@@ -90,6 +90,7 @@ def test_mtcnn(): ...@@ -90,6 +90,7 @@ def test_mtcnn():
annots = mtcnn.annotations(img) annots = mtcnn.annotations(img)
ref_annots = json.load(open(ref_annots)) ref_annots = json.load(open(ref_annots))
assert len(annots) == len(ref_annots), (len(annots), len(ref_annots))
for a, aref in zip(annots, ref_annots): for a, aref in zip(annots, ref_annots):
for k, v in a.items(): for k, v in a.items():
vref = aref[k] vref = aref[k]
......
...@@ -35,8 +35,8 @@ for annotations in detections: ...@@ -35,8 +35,8 @@ for annotations in detections:
("reye", "r"), ("reye", "r"),
("leye", "g"), ("leye", "g"),
("nose", "b"), ("nose", "b"),
("right_of_mouth", "k"), ("mouthright", "k"),
("left_of_mouth", "w"), ("mouthleft", "w"),
): ):
plt.gca().add_patch( plt.gca().add_patch(
Circle( Circle(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment