본문 바로가기
딥러닝&머신러닝

Face Swap, DeepFake 공부 순서, 간단 개념 정리

by David.Ho 2023. 4. 26.
728x90
반응형
Tools  Key Features  Link 
Faceswap_GAN(2018)  - Adversarial loss + Perceptual loss 
- AutoEncoder architecture 
https://github.com/shaoanlu/faceswap-GAN
DeepFaceLab(2020)  - Expand from the Faceswap model 
- Multiple face extraction modes 
https://github.com/iperov/DeepFaceLab

https://arxiv.org/abs/2005.05535
FSGAN(2019) - Adjust to both pose and expression variations https://openaccess.thecvf.com/content_ICCV_2019/html/Nirkin_FSGAN_Subject_Agnostic_Face_Swapping_and_Reenactment_ICCV_2019_paper.html
StyleGAN(2019) - New architecture leads to automatic, unsupervised separation of high-level attributes and scale-specific control of the synthesis of images https://openaccess.thecvf.com/content_CVPR_2019/html/Karras_A_Style-Based_Generator_Architecture_for_Generative_Adversarial_Networks_CVPR_2019_paper.html
Face2Face(2016) - Animate the facial expressions of the target video by a source actor and re-render the manipulated output video in a photo-realistic fashion https://openaccess.thecvf.com/content_cvpr_2016/html/Thies_Face2Face_Real-Time_Face_CVPR_2016_paper.html
Nerual Voice Puppetry(2020) - Method for audio-driven facial video synthesis 
- Synthesize videos of a talking head from an audio sequence of another person using 3D face representation
https://arxiv.org/pdf/1912.05566.pdf%22
SimSwap(2021)   https://arxiv.org/abs/2106.06340

SimSwap: An Efficient Framework For High Fidelity Face Swapping


# Facial Manipulations 

사람의 얼굴을 조작하는 기술들은 크게 4가지로 분류할 수 있다. 일반적으로 DeepFake 얼굴 생성이라고 인식되는 카테고리는 3번, 4번의 Facial Expression과 Face Swap이라고 할 수 있다. 

1. Face Synthesis

존재하지 않던 얼굴을 생성하여 기존 얼굴과 합성한다. 최근의 StyleGan 같은 GAN 기법을 이용하여 새로운 얼굴을 생성해낸다.   

관련 논문 : A Style-Based Generator Architecture for Generative Adversarial Networks
https://openaccess.thecvf.com/content_CVPR_2019/html/Karras_A_Style-Based_Generator_Architecture_for_Generative_Adversarial_Networks_CVPR_2019_paper.html

 

2. Face Attributes

기존 얼굴에서 특정 속성만 바꾸는 방법이다. StarGan 같은 GAN을 이용하여 피부나 눈 등 특정 속성만 바꾸는 방법을 의미한다.

관련 논문 : StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation
https://openaccess.thecvf.com/content_cvpr_2018/html/Choi_StarGAN_Unified_Generative_CVPR_2018_paper.html

 

3. Facial Expression 

 얼굴의 표정을 임의로 조정하는 기법이다. Sorce와 Target을 정하여 Fake 이미지를 생성한다. 

관련 논문 : Face2Face: Real-Time Face Capture and Reenactment of RGB Videos
https://openaccess.thecvf.com/content_cvpr_2016/html/Thies_Face2Face_Real-Time_Face_CVPR_2016_paper.html

4. Face swap

두 사람의 얼굴을 서로 바꾸는 방법이다.  Source의 이미지에 Target의 얼굴을 입히는 방법으로 볼 수 있다.  

참고 
FaceSwap  
https://github.com/deepfakes/faceswap#extract
DeepFaceLab: Integrated, flexible and extensible face-swapping framework
https://arxiv.org/abs/2005.05535

# DeepFake 

Deepfake란 새로운 가짜 이미지, 영상을 딥러닝 기반으로 생성해내는 것을 의미한다. 사람의 얼굴을 다른 사람의 얼굴과Swapping 하는 방식으로 볼 수 있다. 

 

AutoEndcoder 

AutoEncoder는 비지도 방식으로 representation을 학습할 때 사용되는 DNN 아키텍쳐이다. 

입력이미지 x와 최대한 비슷한 x`를 만들어내는 과정을 학습시킨다. Bottleneck 부분의 z는 입력의 represenation을 낮은 차원으로 압축시켜 저장하며 decoder를 지났을때 입력과 비슷한 데이터를 만들어낼 수 있다. 또한, labeled data가 필요없는 비지도 방식으로 진행된다. 

 

DeepFake 진행과정 

1. Extraction 

여러장의 얼굴 사진을 학습시키는 과정에서 extraction은 사람의 얼굴을 추출하는 방법이다. 추가적으로 이를 위해, 얼굴의 주요 지점을 저장해놓은 alignmnet file과 mask를 포함시킬 수 있다. 

참고 
https://forum.faceswap.dev/viewtopic.php?t=27

2. Training 

DeepFake의 학습과정은 이미지의 주요 특징을 추출하는 Autoencoder의 방식을 활용해서 진행된다. 공유되는 encoder 부분에서는 일반적으로 similiar한 feature들(눈, 코, 입의 위치)을 공유하며 학습한다. 따라서 Encoder를 지난 latent face에는 공유될 수 있는 일반적인 features들만 표현이 된다. 이후 decoder에서는 identity features들을 학습하게 된다. 예를 들면 입의 크기, 눈의 모양 등 정체성을 나눌 수 있는 feature를 학습한다. 

 

즉, autoencoder는 얼굴 이미지의 latent features을 추출하고 decoder에서는 얼굴 이미지를 재구성하는데 사용된다. 이 과정에서 두 쌍의 인코더 네트워크는 동일하다. 

 

이후의 Faceswap-GAN에서는  adversarial loss를 사용하는 이 autoencoder에 VGGFace perceptual loss를 추가하여 좀 더 사실적이고 고품질로 결과물을 출력한다. 

 

또한 multi-task CNN과 Cycle-GAN을 이용한 FaceNet을 구현한 연구도 진행되었다. 이 방법은 얼굴 감지와 정렬을 안정적으로 진행한다. 

VGG FACE 
https://github.com/rcmalli/keras-vggface
https://www.robots.ox.ac.uk/~vgg/publications/2018/Cao18/cao18.pdf

FaceNet 
https://arxiv.org/pdf/1503.03832.pdf

3. Converting 

앞서 학습된 Encoder와 Decoder를 이용하여 원본 얼굴을 원하는 얼굴과 convert하는 과정을 지난다. 

참고 
https://arxiv.org/abs/1909.11573
728x90
반응형

댓글