ai-forever / ghost

A new one shot face swap approach for image and video domains
Apache License 2.0
1.25k stars 264 forks source link

Adjust blend priority to make new face mask more prominent? #67

Open DennisBora opened 1 year ago

DennisBora commented 1 year ago

Hi, I'm trying to figure out if its somehow possible to adjust the blending between the source and destination face. The detection/replacement itself works fine, but I would like to preserve the color of the new face and give it also a bit more priority. Depending on the source image/video I feel that some results still have too much features/similarities to the original source and I would like to figure out if its somehow possible to preserve more infos from the new face.

Would be great if someone could point me towards the corresponding modules that have the most influence on the visual outcome of the swap.

AlexanderGroshev commented 1 year ago

Hi, @DennisBora!

There are a few options you can try to keep more information from the new face: 1) You can try to train the model with a higher identity loss --weight_id - this makes the generated face look more like the original face than the target/destination face. 2) Edit masks.py. You get the final result by superimposing the generated face on the original frame using a mask. This way, varying the shape of mask makes the final face closer to the new face or the destination face.