A script to make it simple to swap faces in movies utilizing the deepfakes/faceswap library, and urls of YouTube movies for coaching information. The picture above exhibits a face swap from Jimmy Fallon (host of The Tonight Present) to John Oliver (host of Final Week Tonight).
You are watching: face swap library
I wrote this script to assist me discover the capabilities and limitations of the video face swapping expertise often called Deepfakes.
Learn all about it on this detailed weblog put up.
What does this script do? It makes it trivially simple to accumulate and preprocess coaching information from YouTube. This drastically simplifies the work required to setup a brand new mannequin, since typically all it is advisable to do is locate 3-4 movies of every particular person to get respectable outcomes.
There’s a photoshopservices.web file within the repo, however to make all of it work, you may want CUDA libraries put in, and ideally Dlib compiled with CUDA help.
Setup your mannequin and coaching information in code, e.g.:
Then create the listing ./information/individuals and put one picture containing the face of particular person A and one other of particular person B. Use the identical title that you just did when establishing the mannequin. This file is used to filter their face from any others within the movies you present. E.g.:
Then, preprocess the information. This downloads the movies, breaks them into frames, and extracts the related faces, e.g.:
Then practice the mannequin, e.g.:
Lastly, convert any video that’s saved on disk, e.g.:
Observe that you could get helpful utilization data simply by operating: python photoshopservices.web -h
This script is shared beneath the MIT license, however the library it is dependent upon at present has no license. Beware!
Copyright 2018 Gaurav Oberoi (firstname.lastname@example.org)
Permission is hereby granted, freed from cost, to any particular person acquiring a duplicate of this software program and related documentation recordsdata (the “Software program”), to deal within the Software program with out restriction, together with with out limitation the rights to make use of, copy, modify, merge, publish, distribute, sublicense, and/or promote copies of the Software program, and to allow individuals to whom the Software program is furnished to take action, topic to the next situations:
The above copyright discover and this permission discover shall be included in all copies or substantial parts of the Software program.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.