(Version 1.2.2)
An example of the low resolution image cropped, background removed, angle set for best generative img2img processing and first processing pass.
The red dots indicate the original position of the landmark detection. The image behind it is the face tilted to the most ideal upright angle for generative img2img processing.
For final image composite a robust mask inpainting mask is applied so it doesn't receive a second generative process, but the rest of the image does. This allows for very good results of generative blending with the rest of the image.
FacePop is a robust extension for AUTOMATIC1111's Stable Diffusion Web UI that enhances image processing by detecting, enhancing, and managing faces within images. Leveraging advanced technologies like Mediapipe, MODNet, and ControlNet, FacePop streamlines tasks such as face detection, background removal, and image enhancement directly within your Stable Diffusion workflow.
FacePop was developed as a solution to the limitations encountered with existing tools like Zoom Enhancer, eliminating the need for additional extensions such as Unprompted. While Zoom Enhancer provides basic facial zoom capabilities, FacePop offers more control and flexibility over facial detection and processing features. This extension not only enhances the zoom functionality but also integrates seamlessly with other popular plugins like ControlNet, ReActor, and After Detailer.
By leveraging these integrations, FacePop allows users to customize their image processing workflows extensively, ensuring that each facial enhancement task can be fine-tuned to meet specific requirements. Whether it's for facial feature refinement, background removal, or advanced image manipulation techniques, FacePop provides the necessary tools to achieve better results. This approach ensures that users have greater control over their image enhancements, making FacePop a valuable tool for anyone looking to improve their Stable Diffusion experience.
FacePop simplifies facial image processing within the Stable Diffusion workflow by offering a straightforward and customizable solution. Here's how FacePop works:
Face Detection:
Face Cropping and Upscaling:
Rotating Faces Upright:
Separate Processing of Faces:
Mask Creation and Integration:
Final Image Composite and Processing:
Why FacePop?
With FacePop, you get:
By handling faces in a structured and efficient way, FacePop helps you achieve high-quality images with minimal effort. Whether you're tweaking a single portrait or handling multiple faces in a group shot, FacePop streamlines the process, making your image enhancements faster and more reliable.
Before installing FacePop, ensure you have the following:
Open Stable Diffusion Web UI: Launch your Stable Diffusion Web UI as you normally would.
Navigate to Extensions:
Click on the Extensions
tab in the sidebar.
Install from URL:
Install from URL
button.https://github.com/TheCodeSlinger/FacePop.git
Install
.
Restart Web UI: After installation, you may be prompted to restart the Web UI. Follow the prompt to apply changes.
Verify Installation:
Extensions
tab to ensure FacePop
is listed.FacePop
panel.Open Img2Img Interface:
Navigate to the Img2Img
tab within the Stable Diffusion Web UI.
Locate FacePop Panel:
Scroll down to find the FacePop
accordion or panel.
Configure Settings:
Process Image:
Generate
to process the image with FacePop enhancements.Review Results:
deny_scripts_list.txt
is a crucial configuration file in the FacePop extension that allows users to specify which scripts should be ignored during specific processing stages. This ensures seamless integration and prevents potential conflicts between FacePop and other extensions or scripts within the Stable Diffusion Web UI.
The primary purpose of the deny_scripts_list.txt
file is to control the activation of certain scripts during different phases of the image processing workflow. By specifying scripts to be ignored, FacePop can operate without interference, ensuring optimal performance and stability.
The deny_scripts_list.txt
file is organized into sections, each corresponding to a different processing stage. Within each section, you can list the names of scripts that should be disabled during that particular stage.
; ignore any of these scripts when faces are being processed
[faces]
ADetailer
; ignore any of these scripts during final image composite
[final]
ReActor
NOTE: The main reason ReActor is excluded from final process is it seems to ingore inpaint masks, which the final composite image requires to prevent double processing of the face.
NOTE: ADetailer, we want to work but only on the final compsite image, not the upscaled cropped face. Some features in Adetailer work on other things like fingers and full body that may not be visible in just the face upscale. It hasn't been fully tested yet, and the final mask may prevent it from working as intended and I may need to come back to a solution for that if issues are submitted requesting this.
Figure 1: FacePop panel within the Img2Img interface.
Figure 2: Comparison of an image before and after FacePop processing.
FacePop relies on several third-party libraries and tools to function effectively:
These dependencies are automatically handled during installation via the Extensions Manager. If you encounter issues, you can manually install them using pip
:
pip install mediapipe modnet torch torchvision opencv-python gradio
FacePop utilizes pre-trained models for efficient and accurate face detection. Below are the details of the essential model files used, including their descriptions and licensing information.
Description:
The deploy.prototxt
file defines the architecture of the Single Shot Multibox Detector (SSD) model used for face detection. It specifies the layers, parameters, and configurations required to deploy the model using OpenCV's Deep Neural Network (DNN) module.
Download Link:
You can download the deploy.prototxt
file directly from the FacePop repository.
License:
The deploy.prototxt
file is part of the OpenCV project and is licensed under the Apache-2.0 License.
Description:
The res10_300x300_ssd_iter_140000.caffemodel
is the pre-trained weights file for the SSD (Single Shot Multibox Detector) model with a ResNet-10 backbone. This model is optimized for face detection and is widely used in conjunction with the deploy.prototxt
configuration file to perform real-time face detection tasks.
Download Link:
You can download the res10_300x300_ssd_iter_140000.caffemodel
file directly from the FacePop repository.
License:
Similar to the deploy.prototxt
, the res10_300x300_ssd_iter_140000.caffemodel
is part of the OpenCV project and is licensed under the Apache-2.0 License.
Description:
MODNet is used for background removal and matting. It provides high-quality portrait matting by accurately separating the foreground (person) from the background.
Download Link:
You can download the MODNet model files directly from the FacePop repository.
License:
MODNet is licensed under the Apache-2.0 License.
All these are already included, you don't need to go donwload them unless you want to get them directly from the source.
Download the Files:
Place the Files in \stable-diffusion-webui\extensions\FacePop\scripts\
:
MIT License
Copyright (c) 2024 TheCodeSlinger
Permission is hereby granted, free of charge, to any person obtaining a copy
...
[10-07-2024] Bug Fixes, Retooled lots of stuff, added Restore Eyes (version 1.2.0)
[09-24-2024] Fixed some Inpainting issues (version 1.1.2)
[09-23-2024] Inlcuded mediapipe in installer.py (version 1.1.1)
[09-23-2024] Bug Fixes and Feature integrations (version 1.1.0)
[09-19-2024] Original release (version 1.0.0)