Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

feat: add windows env with cuda support #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ angela_merkel_speech.mp4
shape_predictor_68_face_landmarks.dat

*.mp4
*.gif
*.bz2
tmp*
*.pb
Expand Down
38 changes: 32 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ You just read original description, after this modification it is not working in
git clone https://github.com/karolmajek/face2face-demo.git --recursive

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

# Create the conda environment from file (Windows)
conda env create -f environment-windows.yml
```
> On Windows, make sure to switch `tensorflow-gpu` to `tensorflow` if you do not have cuda support [cuda 10](https://developer.nvidia.com/cuda-10.0-download-archive) [cuDNN v7.4.1](https://developer.nvidia.com/rdp/cudnn-archive) [instructions using cuda 9](https://medium.com/@akshaysin_86681/installing-cuda-and-cudnn-on-windows-10-f735585159f7)

### 2. Generate Training Data

Expand Down Expand Up @@ -90,7 +94,11 @@ python pix2pix.py \
--max_epochs 200 \
--input_dir photos/combined/train \
--which_direction AtoB

# View training progress
tensorboard --logdir face2face-model
```
> To view the training progress after starting tensorboard navigate to [http://localhost:6006/](http://localhost:6006/)

For more information around training, have a look at Christopher Hesse's [pix2pix-tensorflow](https://github.com/affinelayer/pix2pix-tensorflow) implementation.

Expand Down Expand Up @@ -123,19 +131,31 @@ For more information around training, have a look at Christopher Hesse's [pix2pi

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

### 5. Run Demo
### 5. Run Webcam 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.
- `save` save video to output.avi (default= 0 = false).

### 5. Run Video Demo

```
python run_video.py --source path/to/video.mp4 --show 1 --landmark-model shape_predictor_68_face_landmarks.dat --tf-model face2face-reduced-model/frozen_model.pb --save 1
```

Input:

- `source` path to video.
- `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.
- `save` save video to output.avi (default= 0 = false).


## Models
Expand All @@ -148,9 +168,15 @@ Input:

Pre-trained frozen model [here](https://dl.dropboxusercontent.com/s/rzfaoeb3e2ta343/face2face_model_epoch_200.zip). This model is trained on 400 images with epoch 200.

### Adrian Babilinski - Angela Merkel 1024x1024

![example](example-babilinski.gif)

Pre-trained updated Anglea Merkel frozen model [here](https://1drv.ms/u/s!ArYK29BEbxyk4tBpuWzwZzfiY8arRQ?e=RPzhhs). This model is trained on 400 images with epoch 200. (.98GB)

### Karol Majek - Krzysztof Gonciarz 1024x1024

Me, my face and output:
Karol Majek face and output:

![Face2Face Gonciarz](example-gonciarz.gif)

Expand All @@ -159,7 +185,7 @@ Video on youtube:

[![Face2Face Krzysztof Gonciarz YAPZTAJ KASIĘ CICHOPEK 4 - Zapytaj Beczkę #146](http://img.youtube.com/vi/v5VDJKCrP6A/0.jpg)](http://www.youtube.com/watch?v=v5VDJKCrP6A)

Frozen model can be downloaded from [here](https://goo.gl/8BgnXA) (1.1GB)
~~Frozen model can be downloaded from [here](https://goo.gl/8BgnXA) (1.1GB)~~ _link is broken_

## Requirements
- [Anaconda / Python 3.5](https://www.continuum.io/downloads)
Expand Down
File renamed without changes.
51 changes: 51 additions & 0 deletions environment-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: face2face-demo
channels:
- menpo
- conda-forge
- pytorch
- defaults
dependencies:
- blas=1.0=mkl
- boost=1.63.0=py35_vc14_0
- bzip2=1.0.6=hfa6e2cd_1002
- ca-certificates=2020.4.5.1=hecc5488_0
- certifi=2018.8.24=py35_1001
- dlib=19.4=np113py35_200
- icc_rt=2019.0.0=h0cc432a_1
- intel-openmp=2019.4=245
- jpeg=9b=hb83a4c4_2
- libpng=1.6.28=vc14_1
- m2w64-gcc-libgfortran=5.3.0=6
- m2w64-gcc-libs=5.3.0=7
- m2w64-gcc-libs-core=5.3.0=7
- m2w64-gmp=6.1.0=2
- m2w64-libwinpthread-git=5.0.0.4634.697f757=2
- mkl=2017.0.4=h6d528fc_0
- msys2-conda-epoch=20160418=1
- numpy=1.13.3=py35hb69e940_3
- opencv3=3.1.0=py35_0
- openssl=1.1.1f=hfa6e2cd_0
- pip=9.0.1=py35_1
- python=3.5.3=3
- setuptools=27.2.0=py35_0
- sqlite=3.13.0=vc14_0
- tbb=4.4_20160413=vc14_1
- tk=8.5.19=vc14_0
- vc=14=h21ff451_11
- vs2015_runtime=14.16.27012=h30e32a0_2
- wheel=0.29.0=py35_0
- wincertstore=0.2=py35_1002
- xz=5.2.2=0
- zlib=1.2.8=vc14_3
- pip:
- backports-weakref==1.0rc1
- bleach==1.5.0
- html5lib==0.9999999
- imutils==0.4.3
- markdown==2.6.8
- protobuf==3.3.0
- six==1.10.0
- tensorflow-gpu==1.14.0
- werkzeug==0.12.2
prefix: C:\ProgramData\Anaconda3\envs\face2face-demo

Binary file added example-babilinski.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.