dchatel / comfyui_facetools

These custom nodes provide a rotation aware face extraction, paste back, and various face related masking options.
MIT License
48 stars 7 forks source link

Paste sometimes leaves seams #20

Open EricRollei opened 1 month ago

EricRollei commented 1 month ago

When several faces in an image are close together, there's a chance a seam will result, even when feathering is set high. This may result only in my workflow as I've tried to separate out the gender into two different paths? I've tried setting the crop area lower, the different crop methods, but would it be possible to use something like segment anything where just the face can be masked? You may know if one gets better results with some surrounding area. Currently, I'm also trying to use both Moondream and Florence2 to create a more specific prompt for the face detail that includes gender, age, and some description. For mixed-age and mixed-gender images, it's beneficial. Here's the workflow showing that both faces were reconstructed well. You can see the output from both florence2 and moondream also. image

But after pasting the male face detail crop the result is here - you can see the seam showing on her chin and something strange in the image in that area. image

Again, this maybe more a fault of my method to sort male and female faces, but I wanted to flag it to you anyhow. If I can get the AI description working well, I may be able to pass all faces through one path.

dchatel commented 4 weeks ago

Nothing prevents you from using another node to compute a mask from the cropped face.

That said, what you're seeing here is probably caused by the proximity of the two faces. bisenet and johnatanidu models are trained in a such way that they don't make the difference between multiple faces. One way you can fix this issue is by using convex_hull mask, or if you still want the occlusion aware masks provided by bisenet or johnatanidu, you can compute a multiplication between the convex_hull mask and either of the two occlusion aware masks.