Git Product home page Git Product logo

face_swap's Introduction

Overview

Dependencies:

1. Ubuntu 16.04
2. python3.5
3. Python dependencies such as numpy
4. Tensorflow >= 1.4
5. OpenCV 3.4.9

Instructions to run program:

  1. Phase 1 (Conventional Pipeline):

1.  Create a folder in which you can put the requisite videos and images.
2.  Run command 'python3 dataUtils/dataGeneration.py --video <Target-Video-File-Path> --sourceImg <source-Image-File-Path>
--method <tps-Tri-TriD> --shape_predictor <landmark-dat-file> --output_name <Path-and-Name-of-output-file-with-.mp4-in-the-name>' to start generating video with faces swapped. 

Default Values have been given as inputs. The test results for the project are stored in a separate 'Test' folder inside the 'Data' folder.

Different methods specified under --method flag determines the algorithm that needs to be used for face swapping. tps is for This Plate Splines, Tri fror triangulation, and TriD for using triangulation on videos with two faces.

  1. Phase 2 (Deep Learning):

This includes the modified version of code. Download the PRN trained model at Google Drive, and put it into Data/net-data. In order to run it for our use case follow the instructions below:

1. Navigate to the PRNet folder.
2. CUDA_VISIBLE_DEVICES=0 python custom_input.py -i <path of the target video> -r <path of the source image> --video <1 if the target is video and 0 if it is image> --output_name <path of the utput video/image> --face <number of faces>
Example: CUDA_VISIBLE_DEVICES=0 python custom_input.py -i ../TestSet_P2/Test2.mp4 -r ../TestSet_P2/Scarlett.jpg --video 1 --output_name ../TestSet_P2/Data2OutputPRNet.mp4 --face 2

If no GOU is present on the system then remove CUDA_VISIBLE_DEVICES=0 from the above command.

face_swap's People

Contributors

abhibaner avatar arjung27 avatar

Watchers

James Cloos avatar  avatar

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.