ComfyUI  >  Nodes  >  ComfyUI-FaceChain >  FC FaceDetectCrop

ComfyUI Node: FC FaceDetectCrop

Class Name

FC FaceDetectCrop

Category
facechain/model
Author
THtianhao (Account age: 3700 days)
Extension
ComfyUI-FaceChain
Latest Updated
6/25/2024
Github Stars
0.1K

How to Install ComfyUI-FaceChain

Install this extension via the ComfyUI Manager by searching for  ComfyUI-FaceChain
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-FaceChain 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

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

FC FaceDetectCrop Description

Detects and crops faces from images for AI artists, with advanced algorithms for accurate identification and customization options.

FC FaceDetectCrop:

The FC FaceDetectCrop node is designed to detect and crop faces from an input image, providing a focused and enhanced view of the detected face. This node is particularly useful for AI artists who want to isolate facial features for further processing or artistic manipulation. By leveraging advanced face detection algorithms, the node ensures accurate identification and cropping of faces, even in complex images. The node offers flexibility in terms of cropping ratio and mode, allowing you to customize the output to suit your specific needs. Additionally, it can handle scenarios where no face is detected, providing a robust solution for various image processing tasks.

FC FaceDetectCrop Input Parameters:

source_image

This parameter represents the input image from which the face will be detected and cropped. It should be provided in the IMAGE format.

face_index

This integer parameter specifies which face to crop in case multiple faces are detected in the image. The default value is 0, meaning the first detected face will be cropped. The value ranges from 0 to 10, with a step of 1.

crop_ratio

This float parameter determines the ratio of the crop area around the detected face. A higher value results in a larger area around the face being included in the crop. The default value is 1.0, with a range from 0 to 10 and a step of 0.1.

mode

This parameter allows you to choose the cropping mode. The available options are "normal" and "square 512 width height". The "normal" mode crops the face as detected, while the "square 512 width height" mode ensures the cropped area is resized to 512x512 pixels.

error_when_no_face

This boolean parameter controls the behavior when no face is detected in the image. If set to true (enabled), an error will be raised when no face is found. If set to false (disabled), the node will return the original image without any cropping. The default value is false.

FC FaceDetectCrop Output Parameters:

IMAGE

This output represents the cropped image containing the detected face. If no face is detected and error_when_no_face is false, it returns the original image.

MASK

This output provides a mask of the cropped area, highlighting the region of the face in the original image. If no face is detected, this will be None.

BOX

This output contains the bounding box coordinates of the detected face in the original image. If no face is detected, this will be None.

KEY_POINT

This output provides the key points of the detected face, such as the positions of the eyes, nose, and mouth. If no face is detected, this will be None.

FC FaceDetectCrop Usage Tips:

  • To ensure the best results, use high-resolution images where faces are clearly visible.
  • Adjust the crop_ratio parameter to include more or less area around the detected face, depending on your artistic needs.
  • Use the "square 512 width height" mode if you need a standardized output size for further processing or model input.

FC FaceDetectCrop Common Errors and Solutions:

No face detected or face index error/没有检测到人脸或者人脸的索引错误

  • Explanation: This error occurs when no face is detected in the image or the specified face_index is out of range.
  • Solution: Ensure that the input image contains a visible face and that the face_index is within the valid range. If you do not want the node to raise an error when no face is detected, set error_when_no_face to false.

Invalid crop ratio value

  • Explanation: This error occurs when the crop_ratio parameter is set to a value outside the allowed range (0 to 10).
  • Solution: Adjust the crop_ratio parameter to a value within the valid range.

Invalid mode value

  • Explanation: This error occurs when an unsupported value is provided for the mode parameter.
  • Solution: Ensure that the mode parameter is set to either "normal" or "square 512 width height".

FC FaceDetectCrop Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-FaceChain
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.