Spaces:
Running
Running
paresh95
commited on
Commit
·
0f7be63
1
Parent(s):
653b422
PS | Temp fix bug in symmetry script
Browse files- src/face_symmetry.py +4 -4
src/face_symmetry.py
CHANGED
@@ -118,9 +118,10 @@ class GetFaceSymmetry:
|
|
118 |
)
|
119 |
(startX, startY, endX, endY) = box.astype("int")
|
120 |
face = image[startY:endY, startX:endX]
|
121 |
-
face
|
122 |
-
|
123 |
-
|
|
|
124 |
|
125 |
if d["mse"] < lowest_mse:
|
126 |
best_face_data, best_left_half, best_right_half = (
|
@@ -132,7 +133,6 @@ class GetFaceSymmetry:
|
|
132 |
|
133 |
full_face = np.hstack((best_left_half, best_right_half))
|
134 |
full_face = PILImage.fromarray(full_face)
|
135 |
-
|
136 |
return full_face, best_face_data
|
137 |
|
138 |
|
|
|
118 |
)
|
119 |
(startX, startY, endX, endY) = box.astype("int")
|
120 |
face = image[startY:endY, startX:endX]
|
121 |
+
if face.shape[0] != 0: # temp fix bug where image of dim (0, 0, 3) appear
|
122 |
+
face = self.postprocess_face(face)
|
123 |
+
left_half, right_half = self.get_face_halves(face)
|
124 |
+
d = self.get_face_similarity_results(left_half, right_half)
|
125 |
|
126 |
if d["mse"] < lowest_mse:
|
127 |
best_face_data, best_left_half, best_right_half = (
|
|
|
133 |
|
134 |
full_face = np.hstack((best_left_half, best_right_half))
|
135 |
full_face = PILImage.fromarray(full_face)
|
|
|
136 |
return full_face, best_face_data
|
137 |
|
138 |
|