Install this extension via the ComfyUI Manager by searching
for ComfyUI-AutoCropFaces
1. Click the Manager button in the main menu
2. Select Custom Nodes Manager button
3. Enter ComfyUI-AutoCropFaces in the search bar
After installation, click the Restart button to
restart ComfyUI. Then, manually
refresh your browser to clear the cache and access
the updated list of nodes.
Visit
ComfyUI Online
for ready-to-use ComfyUI environment
ComfyUI-AutoCropFaces leverages RetinaFace technology to detect and automatically crop faces in images, streamlining the process of isolating facial features for further analysis or processing.
ComfyUI-AutoCropFaces Introduction
ComfyUI-AutoCropFaces is an extension designed to help AI artists automatically detect and crop faces in images using the powerful RetinaFace model. This tool is particularly useful for those who work with images containing multiple faces and need to focus on specific ones. By automating the face detection and cropping process, ComfyUI-AutoCropFaces saves time and ensures consistency, allowing you to concentrate on the creative aspects of your work.
How ComfyUI-AutoCropFaces Works
ComfyUI-AutoCropFaces leverages the RetinaFace model to detect faces within an image. Once the faces are detected, the extension can automatically crop the image to focus on one or more faces based on your preferences. Think of it as having a smart assistant that can identify and zoom in on the faces in your photos, ensuring that each face is perfectly centered and framed according to your specifications.
Basic Principles:
Face Detection: The extension uses RetinaFace to scan the image and identify all the faces present.
Face Selection: You can specify which face(s) to focus on by setting parameters like the number of faces to detect and the starting index.
Cropping: The extension crops the image around the selected face(s), applying any additional padding or adjustments as specified by you.
ComfyUI-AutoCropFaces Features
Auto Crop Faces
This feature allows you to detect faces in an image and focus on one of them. Here are the customizable settings:
number_of_faces: Specifies how many faces to detect in total. You can set this from 1 to 100, with a default of 5.
start_index: Determines which face to start with in the detected faces list. The default is 0, and it can be adjusted in steps of 1.
scale_factor: Adds padding around the detected face. A value of 1 means no padding, and you can adjust it from 0.5 to 10, with a default of 1.5.
shift_factor: Controls the vertical placement of the face in the output image. Set to 0 to place the face at the top edge, 0.5 to center it, and 1.0 to place it at the bottom edge. The default is 0.45.
max_faces_per_image: Limits the number of faces to detect per image. You can set this from 1 to 1000, with a default of 50.
aspect_ratio: Defines the aspect ratio for cropping. The default is 1, and it can be adjusted from 0.2 to 5.
ComfyUI-AutoCropFaces uses the RetinaFace model, which is known for its accuracy and efficiency in face detection. The model can be customized to use different backbones like MobileNet0.25 or ResNet50, depending on your needs for speed and accuracy.
Model Options:
MobileNet0.25: Lightweight and fast, suitable for real-time applications or devices with limited computational power.
ResNet50: More accurate but computationally heavier, ideal for applications where precision is critical.
Troubleshooting ComfyUI-AutoCropFaces
Here are some common issues you might encounter while using ComfyUI-AutoCropFaces and how to solve them:
Common Issues and Solutions:
No Faces Detected:
Ensure the image quality is good and faces are clearly visible.
Try increasing the number_of_faces parameter.
Faces Cropped Incorrectly:
Adjust the scale_factor to add more or less padding.
Use the shift_factor to reposition the face within the cropped area.
Out of Bounds Start Index:
The start_index wraps around in a circular fashion. Ensure it is within the range of detected faces.
Frequently Asked Questions:
Why is the cropped face not centered?
Check the shift_factor setting and adjust it to center the face.
Can I detect more than one face in an image?
Yes, adjust the number_of_faces and max_faces_per_image settings accordingly.
Learn More about ComfyUI-AutoCropFaces
For additional resources, tutorials, and community support, you can explore the following:
WAS Node Suite Documentation (https://docs.getsalt.ai/md/was-node-suite-comfyui/)