← Open Source
datitran

face2face-demo

pix2pix demo that learns from facial landmarks and translates this into a face.

ApplicationsOtherPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
1.46k
Stars
410
Forks
+0
This week
4
Contributors
Created 2017-07-02 · Updated 2026-09-12 · #10265 today
Top developers

datitran/face2face-demo is ranked 10,265 with 1,461 stars.

Same-category comparison

datitran/face2face-demo is ranked 10,265 among these 8 peers; buaacyw/GaussianEditor is ranked 10,264.

Same-category comparison
NameRankMetrics
qupath/qupath10,256
Language:
Java
Stars:
1,463
Forks:
363
Description:
QuPath - Open-source bioimage analysis for research.
SmartSchoolAI/ai-to-pptx10,260
Language:
TypeScript
Stars:
1,462
Forks:
187
gabotechs/MusicGPT10,261
Language:
Rust
Stars:
1,462
Forks:
170
Description:
Generate music based on natural language prompts using LLMs running locally.
buaacyw/GaussianEditor10,264
Language:
C++
Stars:
1,461
Forks:
75
Description:
[CVPR 2024] GaussianEditor: Swift and Controllable 3D Editing with Gaussian Splatting.
langchain-ai/openwork10,270
Language:
TypeScript
Stars:
1,459
Forks:
194
scraed/LanPaint10,274
Language:
Python
Stars:
1,458
Forks:
54
Description:
High quality training free inpaint for every stable diffusion model. Supports ComfyUI.
hotovo/aider-desk10,277
Language:
TypeScript
Stars:
1,457
Forks:
129
Description:
Platform for AI-powered software engineers.
11cafe/comfyui-workspace-manager10,281
Language:
TypeScript
Stars:
1,456
Forks:
79
Description:
A ComfyUI workflows and models management extension to organize and manage all your workflows, models in one place. Seamlessly switch between workflows, as well as import, export workflows, reuse subworkflows, install models, browse your models in a single workspace.
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryApplications
SubcategoryOther
KeywordsImage production
Stars1,461
Forks410
Contributors4
Created date2017-07-02
Updated date2026-09-12
Stars in 1 day0
Stars in 7 days0
Rank10,265
Previous rank10,274
Rank change9
7-day stars rank12,568
Previous 7-day stars rank12,604
7-day stars rank change36
Total stars rank8,264
Previous total stars rank8,251
Total stars rank change-13
CountryGermany
README summary

face2face-demo This is a pix2pix demo that learns from facial landmarks and translates this into a face. A webcam-enabled application is also provided that translates your face to the trained face in real-time. Generate Training Data Input: is the name of the video file from which you want to create the data set. is the number of train data to be created. is the facial landmark model that is used to detect the landmarks. A pre-trained

facial landmark model is provided here. Output: Two folders and will be created. If you want to download my dataset, here is also the video file that I used and the generated training dataset (400 images already split into training and validation). Train Model For more information around training, have a look at Christopher Hesse's pix2pix-tensorflow implementation. First, we need to reduce the trained model so that we can use an image tensor as input: 2. Second, we freeze

the reduced model to a single file. I have uploaded a pre-trained frozen model here. This model is trained on 400 images with epoch 200. Run Demo Input: is the device index of the camera (default=0). is an option to either display the normal input (0) or the facial landmark (1) alongside the generated image (default=0). is the facial landmark model that is used to detect the landmarks. Example: Requirements Anaconda / Python 3. 4 Acknowledgments Kudos to

Christopher Hesse for his amazing pix2pix TensorFlow implementation and Gene Kogan for his inspirational workshop.

Frequently asked questions

How many stars and forks are recorded?

datitran/face2face-demo has 1,461 stars and 410 forks.

What is the repository rank?

datitran/face2face-demo is ranked 10,265.

What language and category are recorded?

datitran/face2face-demo has 1,461 stars, uses Python and belongs to Applications.

Which repository is closest in rank?

datitran/face2face-demo is compared with buaacyw/GaussianEditor, ranked 10,264 with 1,461 stars.

README

face2face-demo

This is a pix2pix demo that learns from facial landmarks and translates this into a face. A webcam-enabled application is also provided that translates your face to the trained face in real-time.

Getting Started

1. Prepare Environment

# Clone this repo
git clone git@github.com:datitran/face2face-demo.git

# Create the conda environment from file (Mac OSX)
conda env create -f environment.yml

2. Generate Training Data

python generate_train_data.py --file angela_merkel_speech.mp4 --num 400 --landmark-model shape_predictor_68_face_landmarks.dat

Input:

  • file is the name of the video file from which you want to create the data set.
  • num is the number of train data to be created.
  • landmark-model is the facial landmark model that is used to detect the landmarks. A pre-trained facial landmark model is provided here.

Output:

  • Two folders original and landmarks will be created.

If you want to download my dataset, here is also the video file that I used and the generated training dataset (400 images already split into training and validation).

3. Train Model

# Clone the repo from Christopher Hesse's pix2pix TensorFlow implementation
git clone https://github.com/affinelayer/pix2pix-tensorflow.git

# Move the original and landmarks folder into the pix2pix-tensorflow folder
mv face2face-demo/landmarks face2face-demo/original pix2pix-tensorflow/photos

# Go into the pix2pix-tensorflow folder
cd pix2pix-tensorflow/

# Resize original images
python tools/process.py \
  --input_dir photos/original \
  --operation resize \
  --output_dir photos/original_resized
  
# Resize landmark images
python tools/process.py \
  --input_dir photos/landmarks \
  --operation resize \
  --output_dir photos/landmarks_resized
  
# Combine both resized original and landmark images
python tools/process.py \
  --input_dir photos/landmarks_resized \
  --b_dir photos/original_resized \
  --operation combine \
  --output_dir photos/combined
  
# Split into train/val set
python tools/split.py \
  --dir photos/combined
  
# Train the model on the data
python pix2pix.py \
  --mode train \
  --output_dir face2face-model \
  --max_epochs 200 \
  --input_dir photos/combined/train \
  --which_direction AtoB

For more information around training, have a look at Christopher Hesse's pix2pix-tensorflow implementation.

4. Export Model

  1. First, we need to reduce the trained model so that we can use an image tensor as input:

    python reduce_model.py --model-input face2face-model --model-output face2face-reduced-model
    

    Input:

    • model-input is the model folder to be imported.
    • model-output is the model (reduced) folder to be exported.

    Output:

    • It returns a reduced model with less weights file size than the original model.
  2. Second, we freeze the reduced model to a single file.

    python freeze_model.py --model-folder face2face-reduced-model
    

    Input:

    • model-folder is the model folder of the reduced model.

    Output:

    • It returns a frozen model file frozen_model.pb in the model folder.

I have uploaded a pre-trained frozen model here. This model is trained on 400 images with epoch 200.

5. Run Demo

python run_webcam.py --source 0 --show 0 --landmark-model shape_predictor_68_face_landmarks.dat --tf-model face2face-reduced-model/frozen_model.pb

Input:

  • source is the device index of the camera (default=0).
  • show is an option to either display the normal input (0) or the facial landmark (1) alongside the generated image (default=0).
  • landmark-model is the facial landmark model that is used to detect the landmarks.
  • tf-model is the frozen model file.

Example:

Requirements

Acknowledgments

Kudos to Christopher Hesse for his amazing pix2pix TensorFlow implementation and Gene Kogan for his inspirational workshop.

Copyright

See LICENSE for details. Copyright (c) 2017 Dat Tran.

Nearby in the ranking
Similar items