Avg-Color/Remove Hair for Conversions

Getting errors or found a bug when converting faces from a trained model? Post about them here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Convert process. If you want to get tips, or better understand the Convert process, then you should look in the Convert Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Locked
User avatar
arushishot
Posts: 1
Joined: Tue Mar 28, 2023 7:57 pm

Avg-Color/Remove Hair for Conversions

Post 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!

User avatar
torzdf
Posts: 2671
Joined: Fri Jul 12, 2019 12:53 am
Answers: 159
Has thanked: 131 times
Been thanked: 625 times

Re: Avg-Color/Remove Hair for Conversions

Post 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.

My word is final

Locked