Spaces:
Runtime error
Runtime error
Update generator.py
Browse files- generator.py +4 -2
generator.py
CHANGED
|
@@ -273,12 +273,14 @@ class RetroArtConverter:
|
|
| 273 |
print("Detecting faces...")
|
| 274 |
try:
|
| 275 |
image_np = cv2.cvtColor(np.array(resized_image), cv2.COLOR_RGB2BGR)
|
| 276 |
-
image_np = sorted(image_np, key=lambda x:(x['bbox'][2]-x['bbox'][0])*x['bbox'][3]-x['bbox'][1])[-1] # only use the maximum face
|
| 277 |
faces = self.face_app.get(image_np)
|
| 278 |
-
face = faces[0])
|
| 279 |
|
| 280 |
if len(faces) > 0:
|
| 281 |
has_detected_faces = True
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
face_kps_image = draw_kps(resized_image, face.kps)
|
| 283 |
|
| 284 |
# Get face embeddings (512D from InsightFace)
|
|
|
|
| 273 |
print("Detecting faces...")
|
| 274 |
try:
|
| 275 |
image_np = cv2.cvtColor(np.array(resized_image), cv2.COLOR_RGB2BGR)
|
|
|
|
| 276 |
faces = self.face_app.get(image_np)
|
|
|
|
| 277 |
|
| 278 |
if len(faces) > 0:
|
| 279 |
has_detected_faces = True
|
| 280 |
+
face = faces[0]
|
| 281 |
+
print(f" [OK] Face detected (score: {face.det_score:.3f})")
|
| 282 |
+
|
| 283 |
+
# Get face keypoints image
|
| 284 |
face_kps_image = draw_kps(resized_image, face.kps)
|
| 285 |
|
| 286 |
# Get face embeddings (512D from InsightFace)
|