If you ever wondered whether you can swap face in any video to any face you'd like then you are in the right place. Since today I will explain to you how to do that without any knowledge of programming.
Step 1: Gather Training Data.
You will need to acquire plenty of pictures with the face of the person you want to insert into your video and the person in the video. You can use Google, Bing image search, DuckDuckgo. FaceSwap reposatory has scripts to automatically download large amount of images from some sources.
Examples:
-python faceswap.py extract -i ~/faceswap/photo/ford -o ~/faceswap/data/ford
-python faceswap.py extract -I ~/faceswap/photo/cage -o ~/faceswap/data/cage
Some images may contain a lot of unnecessary elements. So you want your algorithm only to be able to recognize faces and later on swap them. For that you will use HOG.(Histogram of Oriented Gradients)
Step 2: Histogram of Oriented Gradients
It's basically a function call and the link to all prerequisites will be provided in the end of the post. But what happens in the background?
Well, first image is being simplified. Turned into black and white. You do not need colors to recognize faces. Then every pixel is replaced by an arrow pointing from lighter pixel to a darker one:
To make image easier to process we break the image into squares and count how many different directions there are, then replace each square with the direction which has the most counts. In the end we get something like that:
And we going for very simple representation that captures the basic structure of a face in simple way:
Once we have representation, we can compare it. And start to detect faces.
Step 3: Train your model to recognize faces
We can use Autoencoder - Convolutional neural network. This network has an ability to recognize sub-masks which we created in first 2 steps.
Step 4: Feed the video into the model you've trained.
All of the resource to do that can be found in this Git
More information/instructions/resources can be found in this video
Thank you for explaining this. I really enjoy reading and educating myself about insanely advanced tech like this. I truly believe this is the renaissance era of technology that will forever change the landscape of the world. By being as educated as possible, we can keep up with the fast paced changes and stay current in a time where those that don’t are no longer relevant.
Happy to help, mate!
Cool information. Gone are the days of pictures don't lie, even video lie now.
Thx man, In regards to humanity, I hope, sharing this kind of information can help us stay safe!
This post has received a 7.34% upvote from @msp-bidbot thanks to: @alxmuh. Delegate SP to this public bot and get paid daily: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP Don't delegate so much that you have less than 50SP left on your account.
This post has received a 10.53 % upvote from @moneymatchgaming thanks to: @alxmuh. Upvote this Post to Support the MMG Community on Steemit! :)
Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase
https://
3. Type
re
Get Featured Instantly – Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness
You got a 3.98% upvote from @allaz courtesy of @zloyrestorator!
Your post has been resteemed from @imran786 thanks to @alxmuh
Introduction To Re-Steem Services by @imran786!
Next Bid 0.01 & Resteem your other post.
You got upvoted from @adriatik bot! Thank you to you for using our service. We really hope this will hope to promote your quality content!
This post has received a 24.39 % upvote, thanks to: @alxmuh.