GithubHelp home page GithubHelp logo

yeongjoonju / cfr-gan Goto Github PK

View Code? Open in Web Editor NEW
82.0 6.0 7.0 54.83 MB

Complete Face Recovery GAN: Unsupervised Joint Face Rotation and De-Occlusion from a Single-View Image (WACV 2022)

License: Apache License 2.0

Python 100.00%
deep-learning computer-vision face-frontalization face-de-occlusion face-rotation

cfr-gan's Introduction

Complete Face Recovery GAN: Unsupervised Joint Face Rotation and De-Occlusion from a Single-View Image (WACV 2022)

Yeong-Joon Ju, Gun-Hee Lee, Jung-Ho Hong, and Seong-Whan Lee

DOI

[Video] [Paper]

Below images are frontalization and de-occlusion results. The first rows are the input images and the second rows are our results. We crop the results as alignments for input images of facial recognition networks.

Training codes for occlusion robust 3D face reconstruction in this paper are available in here.

Abstract

We present a self-supervision strategy called Swap-R&R to overcome the lack of ground-truth in a fully unsupervised manner for joint face rotation and de-occlusion. To generate an input pair for self-supervision, we transfer the occlusion from a face in an image to an estimated 3D face and create a damaged face image, as if rotated from a different pose by rotating twice with the roughly de-occluded face. Furthermore, we propose Complete Face Recovery GAN (CFR-GAN) to restore the collapsed textures and disappeared occlusion areas by leveraging the structural and textural differences between two rendered images. Unlike previous works, which have selected occlusion-free images to obtain ground-truths, our approach does not require human intervention and paired data.

Quick start

Please read the document to the end before attempting with your images.

Our code was implemented in Ubuntu 16.04 and 18.04. So this code may not support any OS other than Linux OS

  1. Download our trained weights.

  2. Download BFM_model_80.mat and 3D face estimator weights here.

Generate de-occluded and rotated face images given a pose.

python inference.py --img_path test_imgs/input --save_path test_imgs/output --generator_path [saved_path] --estimator_path [saved_path]

Generate training data pairs from your data!!

python generate_pair.py

Please check parameters of main in the code.

!! If you want to use your images, you should align images. Please refer to this repo for alignment. !!

Inference for non-aligned facial images

For alignment, You can use MTCNN or RetinaFace but we recommend to use RetinaFace.

git clone https://github.com/biubug6/Pytorch_Retinaface.git
mkdir Pytorch_Retinaface/weights
Download weights
python inference.py --img_path [your image path] --save_path [your save path] --generator_path [saved_path] --estimator_path [saved_path] --aligner retinaface

Citation

@InProceedings{Ju_2022_WACV,
    author    = {Ju, Yeong-Joon and Lee, Gun-Hee and Hong, Jung-Ho and Lee, Seong-Whan},
    title     = {Complete Face Recovery GAN: Unsupervised Joint Face Rotation and De-Occlusion From a Single-View Image},
    booktitle = {Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV)},
    month     = {January},
    year      = {2022},
    pages     = {3711-3721}
}

Acknowledgement

  1. This work was supported by Institute of Information & communications Technology Planning Evaluation (IITP) grant funded by the Korea government(MSIT) (No. 2019-0-00079, Artificial Intelligence Graduate School Program(Korea University))

  2. This work was supported by Institute for Information & communications Technology Promotion(IITP) grant funded by the Korea government(MSIT) (No.2019-0-01371, Development of brain-inspired AI with human-like intelligence).

cfr-gan's People

Contributors

yeongjoonju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cfr-gan's Issues

About the quality of generated pictures

I put my pics and run the inference.py,but the quality of the generated image is very poor. Not only the background, but also the face quality is very poor. How to improve it?

Occlusion Detection?

How can I pass in an image of a face and determine whether or not it is occluded?

Thanks!

가중치 다운로드 불가

죄송합니다. 요청한 파일이 없습니다.

구글 드라이브로 trained weights를 다운 받을 수 없습니다.

혹시 해결 다운 받을 수 있는 방법이 있는지 궁금합니다.

감사합니다.

Trying to reproduce the paper results

Thank you for your big effort and for sharing the pre-trained model.

It seems that something is missing from my steps.

I'm trying to run the model on this image from the paper:
p5

But here is the result I get:
p5

Which is different from the output on the paper.

I did align the image using RetinaFace by cloning the repo and downloading the pre-trained weights and running the command:

!python /CFR-GAN/Code/inference.py --img_path /CFR-GAN/Input_images --save_path /CFR-GAN/Output_images --generator_path '/CFR-GAN/Saved_models/CFRNet_G_ep55_vgg.pth' --estimator_path '/CFR-GAN/Saved_models/trained_weights_occ_3d.pth' --aligner retinaface

What did I miss? Thanks in advance.

About Paper

Thank you for your remarkable work!
I am interested in your work, but I can't find your paper.
How can I download this paper?
Thanks!

help!!!!!

hey even I am doing a project on face de occlusion does the given code contain the dataset and can you provide the project report of this code

error when processing folder with many images

!python inference.py --img_path /content/inp4 --save_path /content/out4/ --generator_path "/content/CFRNet_G_ep55_vgg.pth" --estimator_path "/content/trained_weights_occ_3d.pth" --aligner retinaface

Loading pretrained model from Pytorch_Retinaface/weights/Resnet50_Final.pth
remove prefix 'module.'
Missing keys:0
Unused checkpoint keys:0
Used keys:456
Finished loading detection model!
Load /content/trained_weights_occ_3d.pth
  5% 84/1743 [00:26<08:40,  3.18it/s]
Traceback (most recent call last):
  File "inference.py", line 101, in <module>
    input_img = estimator3d.align_convert2tensor(img_list[k:until], aligned=(args.aligner is None))
  File "/content/CFR-GAN/generate_pairs.py", line 228, in align_convert2tensor
    lm = self.estimate_five_landmarks(img)
  File "/content/CFR-GAN/generate_pairs.py", line 205, in estimate_five_landmarks
    landm = np.array(landms[0])
IndexError: index 0 is out of bounds for axis 0 with size 0

Second question, thanks to the author

First of all, thank you very much for your answer
If you have the time,

Could you give me an example

I thank you very much

I have read https://github.com/yeongjoonJu/CFR-GAN/blob/main/Readme.md

and

https://github.com/yeongjoonJu/Occlusion-Robust-3D-Face-CFR-GAN/blob/main/readme.md

But I have not been able to reproduce your code CFR-GAN

I downloaded the git clone https://github.com/biubug6/Pytorch_Retinaface.git

BFM_model_80.mat

CFRNet_G_ep55_vgg.pth

Download weights of face parsing networks to faceParsing folder.

Download weights of baseline 3D networks to mmRegressor/network folder.

Download weights of face recognition networks to saved_models folder.

But I still don't know what to do next,

Thank you very much

Thank you, thank you

It would be even better if you could give me a video demonstration

Thank you very much

Instructions for download link and storage path of checkpoint files

The README is a complete mess, and the download links of the checkpoints are disorienting. It seems like the authors don't want you to smoothly run their code. You have to guess and experiment to have any chance of success. When you ask questions in the issues section, they even sarcastically blame you for not understanding the documentation.

Here are the download links that I have verified along with their relative paths.
(1)./model/CFRNet_G_ep55_vgg.pth:
https://koreaoffice-my.sharepoint.com/personal/yj_ju_korea_ac_kr/_layouts/15/download.aspx?SourceUrl=%2Fpersonal%2Fyj%5Fju%5Fkorea%5Fac%5Fkr%2FDocuments%2FCFR%2DGAN%2FCFRNet%5FG%5Fep55%5Fvgg%2Epth
(2)./mmRegressor/BFM/BFM_model_80.mat:
https://koreaoffice-my.sharepoint.com/personal/yj_ju_korea_ac_kr/_layouts/15/download.aspx?SourceUrl=%2Fpersonal%2Fyj%5Fju%5Fkorea%5Fac%5Fkr%2FDocuments%2FCFR%2DGAN%2FBFM%5Fmodel%5F80%2Emat
(3)./mmRegressor/BFM/trained_weights_occ_3d.pth:
https://koreaoffice-my.sharepoint.com/personal/yj_ju_korea_ac_kr/_layouts/15/download.aspx?SourceUrl=%2Fpersonal%2Fyj%5Fju%5Fkorea%5Fac%5Fkr%2FDocuments%2FCFR%2DGAN%2Ftrained%5Fweights%5Focc%5F3d%2Epth
(4)./mmRegressor/BFM/similarity_Lm3D_all.mat:
https://github.com/microsoft/Deep3DFaceReconstruction/tree/master/BFM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.