From cd1a749b955cfa1c8a72f69e94363425975ac7e5 Mon Sep 17 00:00:00 2001 From: klx <128426349+Neokmi@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:16:39 +0800 Subject: [PATCH 1/2] Update batch_face_swap.py Fix the issue of inconsistent return data structure. --- scripts/batch_face_swap.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/batch_face_swap.py b/scripts/batch_face_swap.py index 983cd3c..e60fcb5 100644 --- a/scripts/batch_face_swap.py +++ b/scripts/batch_face_swap.py @@ -174,8 +174,8 @@ def findFaces(facecfg, image, width, height, divider, onlyHorizontal, onlyVertic new_image.paste(processed_image, (x, y)) masks.append(new_image) - if countFaces: - return totalNumberOfFaces + # if countFaces: + # return totalNumberOfFaces if file != None: if FaceDetectDevelopment: @@ -1027,4 +1027,4 @@ def postprocess(self, p, processed, enabled, mainTab, overridePrompt, bfs_prompt # "", "Default Negative Prompt", section=section)) -# script_callbacks.on_ui_settings(on_ui_settings) \ No newline at end of file +# script_callbacks.on_ui_settings(on_ui_settings) From 16c358bede85425ec6e5e88a5cc311ac3a4d6f16 Mon Sep 17 00:00:00 2001 From: klx <128426349+Neokmi@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:20:21 +0800 Subject: [PATCH 2/2] Update face_detect.py Call function passed parameter changed to 0. --- scripts/face_detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/face_detect.py b/scripts/face_detect.py index 24a43d8..b305fc1 100644 --- a/scripts/face_detect.py +++ b/scripts/face_detect.py @@ -304,7 +304,7 @@ def getFaceRectangles(image, known_face_rects, facecfg): def getFaceRectanglesYuNet(img_array, known_face_rects): new_faces = [] - dnn_model_path = autocrop.download_and_cache_models(os.path.join(models_path, "opencv")) + dnn_model_path = autocrop.download_and_cache_models() face_detector = cv2.FaceDetectorYN.create(dnn_model_path, "", (0, 0)) face_detector.setInputSize((img_array.shape[1], img_array.shape[0]))