Coder Social home page Coder Social logo

hrlty / tp-gan Goto Github PK

View Code? Open in Web Editor NEW
493.0 27.0 127.0 57.22 MB

Official TP-GAN Tensorflow implementation for paper "Beyond Face Rotation: Global and Local Perception GAN for Photorealistic and Identity Preserving Frontal View Synthesis"

Home Page: http://www.andrew.cmu.edu/user/ruih2/

License: Other

Python 95.08% MATLAB 4.89% Roff 0.03%
tensorflow computer-vision face-recognition generative-adversarial-network synthesis

tp-gan's Introduction

TP-GAN

Official TP-GAN Tensorflow implementation for the ICCV17 paper "Beyond Face Rotation: Global and Local Perception GAN for Photorealistic and Identity Preserving Frontal View Synthesis" by Huang, Rui and Zhang, Shu and Li, Tianyu and He, Ran.

The goal is to recover a frontal face image of the same person from a single face image under any poses.

Here are some examples from the paper.image

Testing images

Synthesized testing images of all poses, corresponding illumination in Setting 2 (and its cropped input) in MultiPIE can be obtained here Google Drive.

FAQ: Synthesized(not the original) images for other illumination condition and/or training set can be obtained upon request. Unfortunately, I cannot redistribute the original dataset due to copyright. If you would like to access the original MultiPIE dataset, please contact MultiPIE.

Random examples

Here are random examples of 10 testing image pairs for each degree.

15 and 30 degrees:

45 and 60 degrees:

75 and 90 degrees:

Note

It was initially written in Tensorflow 0.12. If you have implemented another version, I'll be happy to reference it here.

This is an initial release of code, which may not be fully tested.

The input is cropped with the Matlab script face_db_align_single_custom.m, which accepts 5 keypoints and outputs a cropped image and transformed keypoints.

Some example cropping outputs is shown in folder data-example.

Our 90-degree model only used 45-90 degree images for training. Other models we trained didn't use 90 degree images. 90 degree images' left and right eye patches coincide.

The 5 keypoints can be extracted from off-the-shelf landmark detectors, e.g. 'Zhang et al. Combining Data-driven and Model-driven Methods for Robust Facial Landmark Detection, 2016'. The synthesis performance is similar to using manually labelled keypoints. See released keypoint files below.

We thank Xiang Wu for providing the face feature network. We load it as DeepFace in the code, the weights are from a custom Light-CNN cafeemodel file. Our implementation borrowed code from the dcgan repo.

Update 0.11:

  • Releasing 5 keypoint locations for MultiPIE Session 1-4 dataset. Please download from here. Most of the 60-90 degrees images are labelled manually, others come from MTCNNv2 detector. If you like it, please consider citing our paper.
  • Adding DeepFace168.pickle weights file for Light-CNN. Please note this is an improved version than the one originally used in the experiment.

Citation and Contact

If you like our work or find our code useful, welcome to cite our paper!

Any suggestion and/or comment would be valuable. Please send an email to Rui at [email protected] or other authors.

  @InProceedings{Huang_2017_ICCV,
  author = {Huang, Rui and Zhang, Shu and Li, Tianyu and He, Ran},
  title = {Beyond Face Rotation: Global and Local Perception GAN for Photorealistic and Identity Preserving Frontal View Synthesis},
  booktitle = {The IEEE International Conference on Computer Vision (ICCV)},
  month = {Oct},
  year = {2017}
  }

License

This code is freely available for free non-commercial use, and may be redistributed under the conditions set by the license. Please, see the license for further details. For commercial queries, please contact Rui Huang and Ran He.

tp-gan's People

Contributors

hrlty avatar mountainone 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tp-gan's Issues

train the model but loss is nan

Is anyone run the model sucessfully? I use the CAS-PEAL-R1 dataset to train the model but the loss is nan. Maybe my data-preprocessing is not correct. Anyone can help me?

DeepFace.pickle

hello, i can not find this file. There just exist DeepFace168.pickle. Can you answer my question? Thank you very much.

share trained tensorflow model file

Can you share the trained model file, I want use it to test face synthetize?
I have not enough data for training TP-GAN model.
Thank you!

seek forhelp

hello,thank you for sharing your code. I am interesting in TP-GAN and want to run a test, can you provide train dataset or a pretrained modelfor me? Thank you

Pre-trained weights again

Hello!

I'm here also really interested in having pre-trained weights for this (as I can't access dataset to train my own model)

Thanks in advance!

what Deepfacepath is

Traceback (most recent call last):
File "TP_GAN-Mar6FS.py", line 1132, in
tf.app.run()
File "/home/anaconda2/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "TP_GAN-Mar6FS.py", line 1128, in main
sample_dir=FLAGS.sample_dir)
File "TP_GAN-Mar6FS.py", line 127, in init
self.loadDeepFace(self.DeepFacePath)
File "TP_GAN-Mar6FS.py", line 866, in loadDeepFace
logging.error(("File '%s' not found. "), DeepFacePath)

Pretrained weights

Can you please also share pretrained weights for DeepFace and the whole model?

Running The Code

I would like to run the code and try to reproduce the results in your paper. How can I do that?
Could you please describe the steps to train the network?

Has someone tested the DeepFace168.pickle on Multi-pie Dataset?

I tested the shared model(DeepFace168.pickle) following the setting in paper(cvpr2015, light-cnn). But the result was not good. I obtained the following result:
15°: 56.7%
30°: 34.0%
45°: 14.7%
60°: 4.9%
Some errors may exist in my program. But I wonder if someone has tested the DeepFace168.pickle on Multi-pie Dataset?

Dataset and weights

Hello,Can you provide the pred weight? And I get some cropped dataset ,but I don't have label files. How to get label file from ".5pt"file?

nan values while training

I managed to start training on the sample data. However after a couple of batches all the lossess instantly turn to nan and the saved output images become black. I'm using python3 and tensorflow 1.4.1. Any ideas?

pickle 报错

您好,您用的pickle模块的版本号是多少?
我在执行这一句时
self.data_dict = pickle.load(file)
遇到错误
·UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence·

Inference

Hi,
Thank you for your work.
As mention is the title, is there any guide to do the inference?

Thank you,
tsly

face alignment

How do you perform face alignment?
Is it to use affine transformation after detecting the key points of the face?

thank u!

structure of dataset

Hi, Thanks for sharing the codes! Could you please tell us the structure of the dataset

main folder and subfolders to make another simple dataset to train this model since I can not bay CMU Multi-PIE Face Database

how to run the code

Thank you for sharing your code. I want to run a test on the model, is it possible to provide a pretrained model as well as the operating steps? Thank you

AttributeError: only_check_args

I encounter the following long error running the TP_GAN-Mar6FS.py program:

.............

Traceback (most recent call last):

File "D:\python\projects\reidentification\face_frontalization\frontalization-master\4_TP-GAN-master\TP_GAN-Mar6FS.py", line 1059, in
tf.compat.v1.app.run()

File "C:\Users\rajak\anaconda3\envs\deep_learning\lib\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)

File "C:\Users\rajak\anaconda3\envs\deep_learning\lib\site-packages\absl\app.py", line 295, in run
flags_parser,

File "C:\Users\rajak\anaconda3\envs\deep_learning\lib\site-packages\absl\app.py", line 364, in _run_init
flags_parser=flags_parser,

File "C:\Users\rajak\anaconda3\envs\deep_learning\lib\site-packages\absl\app.py", line 217, in _register_and_parse_flags_with_usage
if FLAGS.only_check_args:

File "C:\Users\rajak\anaconda3\envs\deep_learning\lib\site-packages\absl\flags_flagvalues.py", line 474, in getattr
raise AttributeError(name)

AttributeError: only_check_args
.............

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.