From 416d43891b8770271544ecc17a9a79610a15a19b Mon Sep 17 00:00:00 2001 From: Amartya Deshmukh Date: Wed, 10 Sep 2025 12:01:16 +0530 Subject: [PATCH 1/3] Update requirements-gpu.txt --- requirements-gpu.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements-gpu.txt b/requirements-gpu.txt index 75dd998..f5bd746 100644 --- a/requirements-gpu.txt +++ b/requirements-gpu.txt @@ -5,7 +5,8 @@ onnx>=1.14.0 protobuf>=3.20.2 opencv-python pandas +albumentations==1.3.1 pydantic safetensors onnxruntime>=1.15.0 -onnxruntime-gpu>=1.15.0 \ No newline at end of file +onnxruntime-gpu>=1.15.0 -- 2.52.0 From 871cadbfc97717fb31fdf27e1d10a814be22472d Mon Sep 17 00:00:00 2001 From: Amartya Deshmukh Date: Wed, 10 Sep 2025 12:01:58 +0530 Subject: [PATCH 2/3] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8684bd2..75f12ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,6 @@ onnx>=1.14.0 onnxruntime>=1.15.0 opencv-python pandas +albumentations==1.3.1 pydantic -safetensors \ No newline at end of file +safetensors -- 2.52.0 From bfc98a8c474386f8b411aa76f7f5540d0c649479 Mon Sep 17 00:00:00 2001 From: Amartya Deshmukh Date: Wed, 10 Sep 2025 12:07:13 +0530 Subject: [PATCH 3/3] Remove ifnude --- requirements-gpu.txt | 1 - requirements.txt | 1 - scripts/faceswaplab_swapping/swapper.py | 3 --- scripts/faceswaplab_utils/imgutils.py | 31 ------------------------- 4 files changed, 36 deletions(-) diff --git a/requirements-gpu.txt b/requirements-gpu.txt index f5bd746..621ef90 100644 --- a/requirements-gpu.txt +++ b/requirements-gpu.txt @@ -1,5 +1,4 @@ cython -ifnude insightface==0.7.3 onnx>=1.14.0 protobuf>=3.20.2 diff --git a/requirements.txt b/requirements.txt index 75f12ff..bdf6ea5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ protobuf>=3.20.2 cython -ifnude insightface==0.7.3 onnx>=1.14.0 onnxruntime>=1.15.0 diff --git a/scripts/faceswaplab_swapping/swapper.py b/scripts/faceswaplab_swapping/swapper.py index 27287f8..bdd85f1 100644 --- a/scripts/faceswaplab_swapping/swapper.py +++ b/scripts/faceswaplab_swapping/swapper.py @@ -22,7 +22,6 @@ from scripts.faceswaplab_swapping import upscaled_inswapper from scripts.faceswaplab_swapping.upcaled_inswapper_options import InswappperOptions from scripts.faceswaplab_utils.imgutils import ( pil_to_cv2, - check_against_nsfw, ) from scripts.faceswaplab_utils.faceswaplab_logging import logger, save_img_debug from scripts import faceswaplab_globals @@ -713,8 +712,6 @@ def process_image_unit( if unit.enable: faces = get_faces(pil_to_cv2(image)) - if check_against_nsfw(image): - return [(image, info)] if not unit.blend_faces and not force_blend: src_faces = unit.faces logger.info(f"will generate {len(src_faces)} images") diff --git a/scripts/faceswaplab_utils/imgutils.py b/scripts/faceswaplab_utils/imgutils.py index 0112ece..08a3c61 100644 --- a/scripts/faceswaplab_utils/imgutils.py +++ b/scripts/faceswaplab_utils/imgutils.py @@ -13,37 +13,6 @@ from scripts.faceswaplab_utils.typing import BoxCoords, CV2ImgU8, PILImage from scripts.faceswaplab_utils.faceswaplab_logging import logger -def check_against_nsfw(img: PILImage) -> bool: - """ - Check if an image exceeds the Not Safe for Work (NSFW) score. - - Parameters: - img (PILImage): The image to be checked. - - Returns: - bool: True if any part of the image is considered NSFW, False otherwise. - """ - - NSFW_SCORE_THRESHOLD = get_sd_option("faceswaplab_nsfw_threshold", 0.7) - - # For testing purpose : - if NSFW_SCORE_THRESHOLD >= 1: - return False - - from ifnude import detect - - shapes: List[bool] = [] - chunks: List[Dict[str, Union[int, float]]] = detect(img) - - for chunk in chunks: - logger.debug( - f"chunck score {chunk['score']}, threshold : {NSFW_SCORE_THRESHOLD}" - ) - shapes.append(chunk["score"] > NSFW_SCORE_THRESHOLD) - - return any(shapes) - - def pil_to_cv2(pil_img: PILImage) -> CV2ImgU8: """ Convert a PIL Image into an OpenCV image (cv2). -- 2.52.0