Skip to main content

Face Changing in Real Time

Project description

Face Changing

mirror

Inspired by neural style and face detection, I combined these two together for face changing just for fun. neural style transfer adopted from fast-neural-style-keras only for inference, the original pretrained models are h5 format and I remove the loss net, convert weights to pb format.

weight file size
hdf5 66.4M
pb 7.4M

Usage

several arguments:

  • input type: should be image, video or camera(default)
  • style: neural style you want to use, choose from des, la, wave, mirror(default)
  • image path: if input type is image, then image path shoud be specified
  • video path: if input type is video, then video path should be specified
  • save path: where to save transferred image or video, not required.

note: video or camera, please press q to exit.

1. From Code

clone this repo, and cd to facechanging.

image
python facechanging/main.py -i image -img ./facechanging/images/Carlos_Moya.jpg -style wave -save ./facechanging/outputs/wave.png

camera
python facechanging/main.py -i camera -style mirror -save ./facechanging/outputs/camera.mp4

video
python facechanging/main.py -i video -video ./facechanging/images/a.webm -style mirror -save ./facechanging/outputs/a_mirror.mp4

2. Install

pp install facechanging and open command line, just same as above, e.g.

image
facechanging -i image -img ./facechanging/images/a.jpg -style la -save ./facechanging/outputs/a_la.png

Demo

Requirement

  • python >= 3.5
  • tensorflow >= 1.5.0
  • keras
  • opencv-python >= 4.0.0

Reference

1.fast-neural-style-keras

Project details


Release history Release notifications

This version

1.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for facechanging, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size facechanging-1.1.0-py3-none-any.whl (31.7 MB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page