From 862d563f08b6740e018b1de133d98e0739c3c8b0 Mon Sep 17 00:00:00 2001 From: carl Date: Thu, 5 Sep 2024 15:21:15 -0300 Subject: [PATCH] patch nd array type issue with the options1-5 in the stack trace --- .../face_recognition-master/examples/blink_detection.py | 9 ++++++--- .../face_recognition-master/face_recognition/api.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/downloads/face_recognition-master/examples/blink_detection.py b/downloads/face_recognition-master/examples/blink_detection.py index bd5bbb624..7dffb9db0 100644 --- a/downloads/face_recognition-master/examples/blink_detection.py +++ b/downloads/face_recognition-master/examples/blink_detection.py @@ -25,7 +25,9 @@ def main(): ret, frame = video_capture.read(0) # cv2.VideoCapture.release() small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) - rgb_small_frame = small_frame[:, :, ::-1] + # CCG 2024-09-04 replace: + # rgb_small_frame = small_frame[:, :, ::-1] + rgb_small_frame = numpy.ascontiguousarray(frame_process[:, :, ::-1]) face_landmarks_list = face_recognition.face_landmarks(rgb_small_frame) process = True @@ -35,8 +37,9 @@ def main(): # get it into the correct format small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25) - rgb_small_frame = small_frame[:, :, ::-1] - + # CCG 2024-09-04 replace: + # rgb_small_frame = small_frame[:, :, ::-1] + rgb_small_frame = numpy.ascontiguousarray(frame_process[:, :, ::-1]) # get the correct face landmarks diff --git a/downloads/face_recognition-master/face_recognition/api.py b/downloads/face_recognition-master/face_recognition/api.py index 80a3f7fbe..5d7488ec4 100644 --- a/downloads/face_recognition-master/face_recognition/api.py +++ b/downloads/face_recognition-master/face_recognition/api.py @@ -115,6 +115,7 @@ def face_locations(img, number_of_times_to_upsample=1, model="hog"): deep-learning model which is GPU/CUDA accelerated (if available). The default is "hog". :return: A list of tuples of found face locations in css (top, right, bottom, left) order """ + print("*********************** LOCAL FACE_RECOGNITION API.PY **********************") if model == "cnn": return [_trim_css_to_bounds(_rect_to_css(face.rect), img.shape) for face in _raw_face_locations(img, number_of_times_to_upsample, "cnn")] else: