This was one of the questions on perfect 0.0 loss : - viewtopic.php?p=5140
that I asked about a year ago when I was known as @ugramund here.
I think a perfect 0.0 loss is not possible while swapping faces but it
is possible when you do something called as Image Recreation.
There is a kind of small trick involved in achieving this perfect 0.0 loss but
let me first explain step by step what I am doing.
I am making a Pre-Trained model to be used in all of my future projects.
For this, I have to first decide with which model I have to go & for that
I do a test which I personally called Image Perfection but later I read
somewhere that it was called as Image Recreation in deep learning.
In this process, we first check how well a model can recreate an image that it sees.
We are not talking about swapping faces now, we just talking about redrawing the image that it sees.
So to do this in Faceswap, I select an image, make 25 copies of it because that's the minimum
number of images you need for faceswap to start training in a folder.
This same folder is used as path to both Inputs A & B.
Now, using this test, I was able to decide with which model I should go so as to get the most
realistic image quickly on my RTX 3080 Ti GPU on an output resolution of 256px or above.
This is just a glimpse from my ongoing SECRET project.
Don't think that the 1.9 million iterations@batch 10 that you are seeing in
this video was done to achieve Image Recreation on this single image. I have a HQ data set of
22k images, out of which a small pre training have been performed on 10K images till now.
This 1.9 million iterations@batch 10 is the result of that small training.
The data set I have for pre training is in 3 parts:-
1)10K images from the Nvidia FFHQ data set
2)10K images from the CelebA HQ data set
3)My own HQ 2k+ image collection
If anyone doesn't know about the Nvidia FFHQ data set, you should definitely read about
how awesome data set it is :-
https://github.com/NVlabs/ffhq-dataset
Perfect 0.0 Loss
So after deciding my model , I was training my model like 20+ hrs a day for the last
1 week on some 10k random images from my 22k data set. Initially when I did some random
Image Recreation tests in between to see how good my model is becoming during the training,
it would take about 3-4 hrs to achieve this kind of image recreation on a single image.
Then a stage came yesterday after which you can now throw any HQ seen/unseen image at my
model & it will recreate that image to 90-92% of this perfection level in just 1hr. But the
very fine details like lip-lines or small dots/marks on the faces which are like 8-10% of the
facial details may still require extra 1-2hrs depending upon how complex the face is.
The face that you see in this video was perfected in some 1hr 20 minutes & my model had
never trained on this image previously.
My model was always trained with SSIM loss function & even when I achieved this level of
Image Recreation on other images, so great that on my 32inch 2k monitor,
I was not able tell the difference when looking from close up, the loss function hovered around
0.00250's & the maximum down I was able to take it was may be 0.00210 & after that I always started
training on new images because I thought as the Image Recreation was so good that it would be
difficult for most people to tell any difference, there is no meaning in training it just to
achieve a loss value of 0.0 .
Now comes the trick part. When I completed the Image Recreation on this particular image, the
loss values were hovering in the region of 0.00245, so just for fun, I thought why not change
the loss function at this stage to see how other loss functions will behave & so when I applied
the very 1st loss fuction "ffl" & started training, it instantly declared a perfect loss of 0.0.
So, for this particular image, at this level of Image Recreation :-
SSIM will show a loss value of 0.00245
ffi will show a loss value of 0.00000
Pre-Trained Models = Real world Professional Models
Let's get straight to the point.
I have seen some people on this forum suggesting that we should not use pre trained
models as it can lead to identity bleeding.
Just tell me, when an engineering graduate comes for a job, do you call him
just an engineer or a pre-trained engineer. Of course you will call him just an engineer
because without that pre-training he would not able do his job or will be very
sloppy at it. The same thing goes in the real world for actual AI work where big industries
use DL/ML Models pre-trained on mammoth size data sets.
Do you think the medical industry where it has to use the AI to predict diseases,
the social media industry where it has to use AI to do Image Recognition on millions of images,
Netflix which predicts viewer patterns using AI, do they build their models from scratch daily.
No, they have models pre trained on huge data sets using thousands of professional level GPUs
for months & after that they are brought in the real world for work and then the models are used
continuously to learn/work more without being changed periodically.
There are basically 3 types of data sets used on a model before it goes for actual real world work:-
1)Training data set
2)Validation data set
3)Test data set
You can Google them & read many articles on it. I am providing just 2 simple links on it :-
https://en.wikipedia.org/wiki/Training, ... _data_sets
https://towardsdatascience.com/train-va ... cb40cba9e7
Even if you go on DeepFaceLab forums, they have pre-trained models.
Why go far, I myself have used the same models pre-trained & used on other
different projects giving me great swaps without any identity bleeding.
I can say this for RealFace, Dfaker & Disney models as I have used them
but cannot say the same for other untested models.
But I know people won't believe without seeing so just wait for a few months till
I complete my training on this 22k data set & then I will show some swap videos here
with the download links to my Pre-Trained/Working model.