ComfyUI  >  Nodes  >  ComfyUI-NegiTools >  Detect Face Rotation for Inpainting 🧅

ComfyUI Node: Detect Face Rotation for Inpainting 🧅

Class Name

NegiTools_DetectFaceRotationForInpainting

Category
utils
Author
natto-maki (Account age: 395 days)
Extension
ComfyUI-NegiTools
Latest Updated
9/15/2024
Github Stars
0.0K

How to Install ComfyUI-NegiTools

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

Detect Face Rotation for Inpainting 🧅 Description

Detects face rotation in images for inpainting masks, aiding AI artists in facial feature manipulation with manual override.

Detect Face Rotation for Inpainting 🧅:

NegiTools_DetectFaceRotationForInpainting is a specialized node designed to detect the rotation of a face within an image and generate a mask for inpainting purposes. This node is particularly useful for AI artists who need to correct or manipulate facial features in their artwork. By analyzing key facial landmarks such as the nose, eyes, and ears, the node calculates the face's orientation and creates a mask that highlights the area of interest. This mask can then be used to apply various inpainting techniques, ensuring that the modifications blend seamlessly with the rest of the image. The node also allows for manual override of the detected rotation, providing flexibility and control over the final output.

Detect Face Rotation for Inpainting 🧅 Input Parameters:

parts

This parameter expects a JSON string that contains the coordinates of key facial landmarks. These landmarks include the nose, right eye, left eye, right ear, and left ear. The node uses these coordinates to calculate the face's center and orientation. The accuracy of the face detection and rotation calculation heavily depends on the precision of these coordinates. The default value is an empty string.

image

This parameter accepts an image input that contains the face to be analyzed. The image should be in a format that the node can process, such as a tensor or a NumPy array. The dimensions of the image are used to scale the coordinates of the facial landmarks appropriately.

radius_scale

This parameter is a float that determines the scaling factor for the radius of the detected face area. It affects the size of the mask generated for inpainting. A higher value will result in a larger mask, while a lower value will produce a smaller mask. The default value is 1.0, with a minimum of 0.1 and a maximum of 5.0. The step size for adjustments is 0.01, and the value is rounded to three decimal places.

overwrite_rotation

This parameter allows you to manually override the detected face rotation. It accepts specific values: "None", "0", "90", "180", and "270". If set to "None", the node will use the automatically detected rotation. Otherwise, it will use the specified rotation value. This feature provides additional control over the face orientation in the final output.

Detect Face Rotation for Inpainting 🧅 Output Parameters:

ROTATION_INV

This output parameter provides the inverse of the detected or specified face rotation. It is an integer value that represents the angle in degrees. The inverse rotation is useful for aligning the face correctly in the image.

MASK

This output parameter is a mask that highlights the detected face area. The mask is a tensor with the same dimensions as the input image, where the face area is marked for inpainting. The mask helps in isolating the face for further processing or modifications.

ROTATION

This output parameter provides the detected or specified face rotation. It is an integer value that represents the angle in degrees. This value indicates the orientation of the face in the input image.

Detect Face Rotation for Inpainting 🧅 Usage Tips:

  • Ensure that the JSON string for the parts parameter is accurate and contains all necessary facial landmarks for optimal face detection and rotation calculation.
  • Adjust the radius_scale parameter to fine-tune the size of the mask according to your inpainting needs. A larger radius may be useful for broader modifications, while a smaller radius can be used for more precise edits.
  • Use the overwrite_rotation parameter to manually set the face rotation if the automatic detection does not yield the desired results. This can be particularly useful for images with unusual angles or poses.

Detect Face Rotation for Inpainting 🧅 Common Errors and Solutions:

"Invalid JSON string for parts parameter"

  • Explanation: The JSON string provided for the parts parameter is not correctly formatted or is missing required facial landmarks.
  • Solution: Ensure that the JSON string is correctly formatted and includes coordinates for the nose, right eye, left eye, right ear, and left ear.

"Unsupported image format"

  • Explanation: The input image is not in a format that the node can process.
  • Solution: Convert the image to a supported format, such as a tensor or a NumPy array, before passing it to the node.

"Radius scale out of bounds"

  • Explanation: The value provided for the radius_scale parameter is outside the allowed range.
  • Solution: Adjust the radius_scale value to be within the range of 0.1 to 5.0.

"Invalid overwrite rotation value"

  • Explanation: The value provided for the overwrite_rotation parameter is not one of the accepted options.
  • Solution: Set the overwrite_rotation parameter to one of the following values: "None", "0", "90", "180", or "270".

Detect Face Rotation for Inpainting 🧅 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-NegiTools
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.