From 9d1b6bf64a23e9711864f0dd2d4855842701ef64 Mon Sep 17 00:00:00 2001 From: Dowon Date: Sun, 19 May 2024 23:36:20 +0900 Subject: [PATCH] fix: numpy typing error --- adetailer/mediapipe.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/adetailer/mediapipe.py b/adetailer/mediapipe.py index fd07619..3d530a5 100644 --- a/adetailer/mediapipe.py +++ b/adetailer/mediapipe.py @@ -98,7 +98,9 @@ def mediapipe_face_mesh(image: Image.Image, confidence: float = 0.3) -> PredictO connection_drawing_spec=drawing_styles.get_default_face_mesh_tesselation_style(), ) - points = np.intp([(land.x * w, land.y * h) for land in landmarks.landmark]) + points = np.array( + [[land.x * w, land.y * h] for land in landmarks.landmark], dtype=int + ) outline = cv2.convexHull(points).reshape(-1).tolist() mask = Image.new("L", image.size, "black") @@ -136,7 +138,9 @@ def mediapipe_face_mesh_eyes_only( masks = [] for landmarks in pred.multi_face_landmarks: - points = np.intp([(land.x * w, land.y * h) for land in landmarks.landmark]) + points = np.array( + [[land.x * w, land.y * h] for land in landmarks.landmark], dtype=int + ) left_eyes = points[left_idx] right_eyes = points[right_idx] left_outline = cv2.convexHull(left_eyes).reshape(-1).tolist()