deepfakes / faceswap-playground

User dedicated repo for the faceswap project
306 stars 194 forks source link

No alignment found for any files when Converting after Extraction. #100

Closed frosty3907 closed 6 years ago

frosty3907 commented 6 years ago

I've tried using yaml and json serializer and both will just say no alignment found for xxx00000.png ... xxx00001.png etc.

The naming convention of the original files is xxxNNNNN.png but I notice the files after Extraction in my Aligned folder are named: xxxNNNNN_0.png - could this be the issue?

Note this could also be the result of my install being messed up, although I'm able to train with my GPU properly the extraction process is incredibly slow.

Command being issued: python faceswap.py convert -i D:\faceswap/data_A/ -o D:\faceswap/data_A/converted -m D:\faceswap/models/ --alignments D:\faceswap/data_A/ -a D:\faceswap/data_A/Aligned --seamless -e 2 -b 2 --serializer yaml

frosty3907 commented 6 years ago

After removing the last two character from all the filenames with the below code I still get the same error :(

set fName=%1 set fName=%fName:~0,-1% set fName=%fName:~1% ren "%fName%.%2" "%fName:~0,-2%.%2"

MT-4ier commented 6 years ago

You'll need those last two characters, because that's what the json/yaml is going to be looking for when converting. Try removing the --alignments argument. You don't need to specify a location for it when extracting or converting. By default it will put it in the Data_A directory.

MT-4ier commented 6 years ago

Or, to be more precise, it will put the alignments file in the input directory when you run Extract.

bryanlyon commented 6 years ago

You don't convert the aligned files, you convert the original files.

On Mar 14, 2018 00:02, "frosty3907" notifications@github.com wrote:

I've tried using yaml and json serializer and both will just say no alignment found for xxx00000.png ... xxx00001.png etc.

The naming convention of the original files is xxxNNNNN.png but I notice the files after Extraction in my Aligned folder are named: xxxNNNNN_0.png - could this be the issue?

Note this could also be the result of my install being messed up, although I'm able to train with my GPU properly the extraction process is incredibly slow.

Command being issued: python faceswap.py convert -i D:\faceswap/data_A/ -o D:\faceswap/data_A/converted -m D:\faceswap/models/ --alignments D:\faceswap/data_A/ -a D:\faceswap/data_A/Aligned --seamless -e 2 -b 2 --serializer yaml

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deepfakes/faceswap-playground/issues/100, or mute the thread https://github.com/notifications/unsubscribe-auth/ADEuwRMqVC8SQeOtdnr2co_yQjk1KflIks5teMCegaJpZM4Sp7ZE .

frosty3907 commented 6 years ago

Ok re-added the suffix with REN .png . REN . _0. REN . .png

And then removed --alignments as advised - Well that seems to have got it working, until I run into my next error I'm sure... Been sitting at this stage for a few minutes now:

compute capability: 6.1) loaded model weights Aligned directory contains an amount of images much less than the input, are you sure this is the right directory? Loading Convert from Convert_Masked plugin... Reading alignments from: D:\faceswap\data_A\alignments.yml

The aligned folder is indeed missing some 20,000 files :( (edit: on second thoughts this is probably correct since many frames don't have a face)

@bryanlyon - so you can convert without any alignments??

MT-4ier commented 6 years ago

About the missing files, did you delete that many "wrong" faces, or did it just not extract all the frames? And I think what bryanlyon meant was that the input folder when converting is the main Data_A folder, not the Aligned folder. You did it right. :)

frosty3907 commented 6 years ago

Yes Alignments would be missing many files since there's no face in frame for a good number of frames.

So it all seems to be working now, are my blur and erosion settings OK? I just took a guess for their value.

MT-4ier commented 6 years ago

Those are probably fine. It depends on the results you're getting. You can look in your Converted directory to see how it's going, and see if you're happy with the results. If not, you can stop the Convert process and try some different values.

bryanlyon commented 6 years ago

No, you use the alignments.json (or yaml) file but the aligned images are optional.

The only requirements are the source images and the model. The alignments.json file just saves you from doing face recognition like you did in extract again. The aligned images aren't actually used for the convert, that option is just there for convenience if you manually filtered.

MT-4ier commented 6 years ago

Ah, okay. I misunderstood. :)

frosty3907 commented 6 years ago

Hmmm... so I think I will extract with fakeapp since it's about 100x quicker, train and convert with faceswap.. might be a work around to my extraction issues.. this is assuming alignments.json from fakeapp works which I believe I've been told it probably won't but it's worth a try.

MT-4ier commented 6 years ago

Have you tried compiling dlib on your computer? I just did that tonight and my CNN extract speed went up by 70x.

frosty3907 commented 6 years ago

Yes I've been trying to get it going for the past 3 days - there's two threads on it here: https://github.com/deepfakes/faceswap-playground/issues/93#issuecomment-372925432 and here: https://github.com/deepfakes/faceswap-playground/issues/95#issuecomment-372895599

Finally got it compiling without the CUDA disabled message but still terribly slow.

MT-4ier commented 6 years ago

Go to a command prompt in your virtual environment, and type pip show dlib That will show you which version you're using and where it's located. You might be using an older installed version that you can delete to make it use a newer one.

frosty3907 commented 6 years ago

Version: 19.9.0

MT-4ier commented 6 years ago

Okay, try this. Go here https://github.com/davisking/dlib and download the zip, then unzip it somewhere convenient. While in your faceswap virtual environment, navigate to that folder, then enter python setup.py install --yes USE_AVX_INSTRUCTIONS That should install dlib 19.9.99 for your virtual environment, then you can delete the 19.9.0 folder. See if that helps.

MT-4ier commented 6 years ago

'pip show dlib' will tell you where it is for sure. It's probably in (username)\Envs\faceswap\Lib\site-packages

frosty3907 commented 6 years ago

I had been using git clone https://github.com/davisking/dlib - I wonder why it wasn't getting the latest one? Complete newb to this stuff. Compiling 19.9.99 now and will pip show dlib once it's done to find the 19.9.0 folder to delete.

Is it normal to have 164 Warnings compiling dlib?

addlayer<dlib::con<32,3,3,1,1,1,1>,dlib::add_tag_layer<1,dlib::add_layer<dlib::maxpool<3,3,2,2,0,0>,SUBNET,v oid>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void> ,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>,void>>,void>,void>,void>,void>,void>,vo id>,void>,void>,void>,void>,void>,void>,void>,void> *,true>': decorated name length exceeded, name was truncated [C:\faceswap\dlib999\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj]

MT-4ier commented 6 years ago

I'm not sure. I'm new to this too, I'm just guiding you through what worked for me. :)

frosty3907 commented 6 years ago

Ok after doing all that it's still 1.31it/s with default extract and cnn scores a woeful 189s/it :(

MT-4ier commented 6 years ago

In your virtual environment, does 'pip show dlib' say that you're using the newest version?

frosty3907 commented 6 years ago

Yep: Version: 19.9.99

MT-4ier commented 6 years ago

Okay, I'm not sure what the problem is then. You could try removing some things from your site-packages folder and re-installing from the 'requirements-gpu-python36-cuda9.txt'

frosty3907 commented 6 years ago

Yep, have tried that.

deepfakesclub commented 6 years ago

Just for sanity's sake, make sure you have the most recent faceswap repo. You didn't change any of the files manually?

Can you paste the exact message from "pip show dlib"? And what is your exact procedure for running faceswap? (i.e. which command prompt, what directory, what do you type, etc.?) Also what does it say when you type PATH into your command prompt?

It's got to be some small, ohhh geez....., type thing.

Also, can you uninstall dlib... and then when you try to extract, do you get an error message? Then, install dlib, extract now works?

frosty3907 commented 6 years ago

I used git clone which I assume gets the most recent? I'd also tried just downloading as a .zip. (fs) C:\faceswap>pip show dlib Name: dlib Version: 19.9.99 Summary: A toolkit for making real world machine learning and data analysis applications Home-page: https://github.com/davisking/dlib Author: Davis King Author-email: davis@dlib.net License: Boost Software License Location: c:\users\XXXX\envs\fs\lib\site-packages\dlib-19.9.99-py3.6-win-amd64.egg Requires:

I setup virtualenv as detailed in install.md - i have link to cmd.exe on desktop set to run as admin, load that, workon fs (setup a new environment from the old faceswap one to troubleshoot) which has the environment root dir as c:\faceswap - previously I was using d:\faceswap

%PATH%'s: PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\QuickTime\QTSystem\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\ffmpeg\bin;C:\Program Files\CMake\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\Craig\AppData\Local\Programs\Python\Python36\Scripts\;C:\Users\Craig\AppData\Local\Programs\Python\Python36\;C:\Users\Craig\AppData\Local\Microsoft\WindowsApps

I've pip uninstall dlib'd heaps of times - when compiling I get 164 warnings about some VOID path or something (shown a few posts up) but the installation seems to succeed.

deepfakesclub commented 6 years ago

Everything looks right if you have one pure python 3.6 install running under the fs environment.

I get 100 something warnings during the build too, but if you proceeded with 0 errors, it sounded like the build process is not the issue. I'm still puzzled too.

The portable build works, so all your drivers and CUDA stuff is okay.

I really have no idea either.

frosty3907 commented 6 years ago

The only thing I can think of now is I think I may recall when I was first trying to get it going it said face_alignment or something was missing (even tho I'd installed the requirements.txt) so perhaps I pip installed a newer (broken?) version of something and it's now using that each time?

That's why I was thinking about going nuclear and starting again but there's so much stuff installed everywhere I wouldn't know where to start.. and I can't format this PC since it has all my work stuff on it.