Page 1 of 1

Avg-Color/Remove Hair for Conversions

Posted: Tue Apr 18, 2023 4:09 pm
by arushishot

Hi,

I'm trying to put my buddy's face on a video of mine, but his long hair is affecting the side of the face, showing black segments around the cheekbone/cheek area (black hair).

I was thinking that maybe using "Avg-Color" for color adjustment would help blend the color with my skin so it wouldn't look weird. But I'm getting red text saying:

"Users\faceswap\plugins\convert\color\avg_color.py:15: RuntimeWarning: invalid value encountered in divide
adjustment = avg_diff / np.sum(raw_mask, axis=(0, 1))"

and:

"Users\faceswap\lib\convert.py:245: RuntimeWarning: invalid value encountered in rint
patched_face = np.rint(patched_face,"

Does that mean it isn't working? Nothing's changed whether I use that or "Match-Hist" for color adjustment.
Do you have any tips for fixing/removing the hair on my friend's face? I'm still new and learning all there is to Faceswap so any tips/suggestions are greatly appreciated! TIA!


Re: Avg-Color/Remove Hair for Conversions

Posted: Wed Apr 19, 2023 11:11 am
by torzdf
arushishot wrote: Tue Apr 18, 2023 4:09 pm

Hi,

I'm trying to put my buddy's face on a video of mine, but his long hair is affecting the side of the face, showing black segments around the cheekbone/cheek area (black hair).

Differing hairlines are difficult. You can read about some potential workarounds here:
viewtopic.php?p=7684

arushishot wrote: Tue Apr 18, 2023 4:09 pm

I was thinking that maybe using "Avg-Color" for color adjustment would help blend the color with my skin so it wouldn't look weird. But I'm getting red text saying:

"Users\faceswap\plugins\convert\color\avg_color.py:15: RuntimeWarning: invalid value encountered in divide
adjustment = avg_diff / np.sum(raw_mask, axis=(0, 1))"

and:

"Users\faceswap\lib\convert.py:245: RuntimeWarning: invalid value encountered in rint
patched_face = np.rint(patched_face,"

Does that mean it isn't working? Nothing's changed whether I use that or "Match-Hist" for color adjustment.

Yes. Most likely there is an invalid value in the model output (a NaN or an Inf value) which is causing this to fail. However, average colour and match-hist will not fix you issue. This is more for matching skin tones.