deepfakes / faceswap

Deepfakes Software For All
https://www.faceswap.dev
GNU General Public License v3.0
50.52k stars 13.06k forks source link

CONVERT super slow, is not using the GPU "1080TI" when it should! #176

Closed ZeroCool22 closed 6 years ago

ZeroCool22 commented 6 years ago

python faceswap.py convert -i C:/faceswap/A -o C:/faceswap/A/merged -m C:/faceswap/models -t GAN -c GAN -D cnn

screenshot_8

I'm very far away from being a Python expert, but if you look at the Anaconda window, it say "Using TensorFlow backend" and shows the model of my GPU ,etc... So from that lecture i understand it should be using the GPU, but NO!

On TRAIN "python faceswap.py train -A C:/faceswap/A/aligned -B C:/faceswap/B/aligned -m C:/faceswap/models -p -t GAN" it use it (low usage but at least it use it):

train gpu

conda list

# packages in environment at C:\ProgramData\Anaconda3\envs\deepfakes:
#
# Name                    Version                   Build  Channel
absl-py                   0.1.10                    <pip>
backports                 1.0              py36h81696a8_1
backports.weakref         1.0rc1                   py36_0
bleach                    1.5.0                    py36_0    conda-forge
boost                     1.64.0              py36_vc14_4  [vc14]  conda-forge
boost-cpp                 1.64.0                   vc14_1  [vc14]  conda-forge
bzip2                     1.0.6                    vc14_1  [vc14]  conda-forge
ca-certificates           2017.08.26           h94faf87_0
certifi                   2018.1.18                py36_0
click                     6.7                       <pip>
cmake                     3.9.4                h4b83b1b_0    anaconda
cudatoolkit               8.0                           3    anaconda
cudnn                     6.0                           0    anaconda
decorator                 4.0.11                   py36_0    conda-forge
dlib                      19.9.99                   <pip>
face-recognition          1.2.1                     <pip>
face-recognition-models   0.3.0                     <pip>
ffmpeg                    3.4.1                         1    conda-forge
freetype                  2.8.1                    vc14_0  [vc14]  conda-forge
h5py                      2.7.1                    py36_2    conda-forge
hdf5                      1.10.1                   vc14_1  [vc14]  conda-forge
html5lib                  0.9999999                py36_0    conda-forge
icc_rt                    2017.0.4             h97af966_0
icu                       58.2                     vc14_0  [vc14]  conda-forge
imageio                   2.1.2                    py36_0    conda-forge
intel-openmp              2018.0.0             hd92c6cd_8
jpeg                      9b                       vc14_2  [vc14]  conda-forge
keras                     2.0.9                    py36_0    conda-forge
libgpuarray               0.7.5                    vc14_0  [vc14]  conda-forge
libiconv                  1.14                     vc14_4  [vc14]  conda-forge
libpng                    1.6.34                   vc14_0  [vc14]  conda-forge
libprotobuf               3.2.0                    vc14_0  [vc14]  anaconda
libtiff                   4.0.9                    vc14_0  [vc14]  conda-forge
libwebp                   0.5.2                    vc14_7  [vc14]  conda-forge
libxml2                   2.9.3                    vc14_9  [vc14]  conda-forge
mako                      1.0.7                    py36_0    conda-forge
Markdown                  2.6.11                    <pip>
markdown                  2.6.9                    py36_0    conda-forge
markupsafe                1.0                      py36_0    conda-forge
mkl                       2018.0.1             h2108138_4
moviepy                   0.2.3.2                  py36_0    conda-forge
numpy                     1.14.0                    <pip>
numpy                     1.12.1           py36hf30b8aa_1    anaconda
olefile                   0.44                     py36_0    conda-forge
opencv                    3.3.0                  py36_200    conda-forge
openssl                   1.0.2n               h74b6da3_0
pillow                    5.0.0                    py36_0    conda-forge
pip                       9.0.1                    py36_1    conda-forge
protobuf                  3.5.1                     <pip>
protobuf                  3.5.1               py36_vc14_3  [vc14]  conda-forge
pygpu                     0.7.5                    py36_0    conda-forge
python                    3.6.4                         0    conda-forge
pyyaml                    3.12                     py36_1    conda-forge
qt                        5.6.2                    vc14_1  [vc14]  conda-forge
scandir                   1.6                      py36_0    conda-forge
scipy                     1.0.0            py36h1260518_0
setuptools                38.4.0                   py36_0    conda-forge
setuptools                38.5.1                    <pip>
six                       1.11.0                    <pip>
six                       1.11.0                   py36_1    conda-forge
sqlite                    3.20.1                   vc14_2  [vc14]  conda-forge
tensorflow-gpu            1.3.0                     <pip>
tensorflow-gpu            1.5.0                     <pip>
tensorflow-tensorboard    1.5.1                     <pip>
tensorflow-tensorboard    0.1.8                     <pip>
theano                    1.0.1                    py36_1    conda-forge
tk                        8.6.7                    vc14_0  [vc14]  conda-forge
tqdm                      4.11.2                   py36_0    conda-forge
vc                        14                            0    conda-forge
vs2015_runtime            14.0.25420                    0    conda-forge
webencodings              0.5                      py36_0    conda-forge
werkzeug                  0.14.1                     py_0    conda-forge
Werkzeug                  0.14.1                    <pip>
wheel                     0.30.0                   py36_2    conda-forge
wheel                     0.30.0                    <pip>
wincertstore              0.2                      py36_0    conda-forge
yaml                      0.1.7                    vc14_0  [vc14]  conda-forge
zlib                      1.2.11                   vc14_0  [vc14]  conda-forge

(deepfakes) C:\faceswap>

OS: Windows 10 creators. CPU: 7700k RAM; 32gb GPU: MSI GTX 1080TI

ByMark commented 6 years ago

This is happening to me too https://github.com/deepfakes/faceswap/issues/175

I reinstall all from zero but not success.

rifterbater commented 6 years ago

Did you rebuild dlib with GPU support? If you use "-D cnn" and haven't done that it uses a CPU version of dlib, which is crazy slow during the face detection step.

ZeroCool22 commented 6 years ago

@rifterbater My DLIB installation was:

python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA

rifterbater commented 6 years ago

Maybe double check dlib console output during setup.py to be certain it went successfully. Even with DLIB_USE_CUDA it can still fail to use cuda and you'll end up with a plain CPU build. There's lots of issues with cuda requiring very specific versions of visual studio to be installed, so it fails to include support frequently.

ZeroCool22 commented 6 years ago

@rifterbater What version of VS i should have installed?

I have these ones:

62ls61ibq-isgpz3_9qfxq

screenshot_4

rifterbater commented 6 years ago

It's real mess. There's no one answer because it's a cuda issue and so varies based on your exact cuda version. Uninstalling VS 2017 and having VS 2015 updated with all the latest patches seems to work the most frequently.

ZeroCool22 commented 6 years ago

Yeah, i never installed the VS 2017, always was the 2015 and i think i have it with all the updates.

ByMark commented 6 years ago

Don't understand what's wrong.

I manually install dlib to be sure with no error and with CUDA enable. Tried to downgrade to cuDNN 5.1 (from cuDNN 6) and reinstall dlib with no luck.

All is installed with no errors but CNN not work with GPU and not sure if this affect the Train too.

Notice so many warnings when install dlib:

d:\dlib-master\dlib\config.h(22): warning C4005: 'DLIB_JPEG_SUPPORT': macro redefinition (compiling source file D:\dlib-master\tools\python\src\numpy_returns.cpp) [D:\dli b-master\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj] d:\dlib-master\dlib\config.h(23): warning C4005: 'DLIB_PNG_SUPPORT': macro redefinition (compiling source file D:\dlib-master\tools\python\src\numpy_returns.cpp) [D:\dlib -master\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj] d:\dlib-master\dlib\config.h(28): warning C4005: 'DLIB_USE_CUDA': macro redefinition (compiling source file D:\dlib-master\tools\python\src\numpy_returns.cpp) [D:\dlib-ma ster\build\temp.win-amd64-3.6\Release\dlib_python.vcxproj] d:\dlib-master\dlib\config.h(22): warning C4005: 'DLIB_JPEG_SUPPORT': macro redefinition (compiling source file D:\dlib-master\tools\python\src\gui.cpp) [D:\dlib-master\b uild\temp.win-amd64-3.6\Release\dlib_python.vcxproj] d:\dlib-master\dlib\config.h(23): warning C4005: 'DLIB_PNG_SUPPORT': macro redefinition (compiling source file D:\dlib-master\tools\python\src\gui.cpp) [D:\dlib-master\bu ild\temp.win-amd64-3.6\Release\dlib_python.vcxproj] d:\dlib-master\dlib\config.h(28): warning C4005: 'DLIB_USE_CUDA': macro redefinition (compiling source file D:\dlib-master\tools\python\src\gui.cpp) [D:\dlib-master\build \temp.win-amd64-3.6\Release\dlib_python.vcxproj]

416 Warning(s) 0 Error(s)

Time Elapsed 00:10:07.06 creating build\bdist.win-amd64 creating build\bdist.win-amd64\egg copying build\lib.win-amd64-3.6\dlib.cp36-win_amd64.pyd -> build\bdist.win-amd64\egg creating stub loader for dlib.cp36-win_amd64.pyd byte-compiling build\bdist.win-amd64\egg\dlib.py to dlib.cpython-36.pyc creating build\bdist.win-amd64\egg\EGG-INFO copying dlib.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO copying dlib.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO copying dlib.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO copying dlib.egg-info\not-zip-safe -> build\bdist.win-amd64\egg\EGG-INFO copying dlib.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt creating dist creating 'dist\dlib-19.9.99-py3.6-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it removing 'build\bdist.win-amd64\egg' (and everything under it) Processing dlib-19.9.99-py3.6-win-amd64.egg creating d:\lib\site-packages\dlib-19.9.99-py3.6-win-amd64.egg Extracting dlib-19.9.99-py3.6-win-amd64.egg to d:\lib\site-packages Adding dlib 19.9.99 to easy-install.pth file

Installed d:\lib\site-packages\dlib-19.9.99-py3.6-win-amd64.egg Processing dependencies for dlib==19.9.99 Finished processing dependencies for dlib==19.9.99

Chequed in tensorflow if GPU is enable: sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

2018-02-11 03:27:20.363564: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX 2018-02-11 03:27:20.747300: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Found device 0 with properties: name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7845 pciBusID: 0000:02:00.0 totalMemory: 6.00GiB freeMemory: 4.97GiB 2018-02-11 03:27:20.747460: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:02:00.0, compute capability: 6.1) Device mapping: /job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:02:00.0, compute capability: 6.1 2018-02-11 03:27:20.933639: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\direct_session.cc:299] Device mapping: /job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:02:00.0, compute capability: 6.1

Test dlib: cmake -G "Visual Studio 14 2015 Win64"

-- Selecting Windows SDK version to target Windows 10.0.16299. -- The C compiler identification is MSVC 19.0.24215.1 -- The CXX compiler identification is MSVC 19.0.24215.1 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of void -- Check size of void - done -- Enabling SSE2 instructions -- Searching for BLAS and LAPACK -- Searching for BLAS and LAPACK -- Looking for pthread.h -- Looking for pthread.h - not found -- Found Threads: TRUE -- A library with BLAS API not found. Please specify library location. -- LAPACK requires BLAS -- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0 (found suitable version "8.0", minimum required is "7.5") -- Looking for cuDNN install... -- Found cuDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64/cudnn.lib -- Building a CUDA test project to see if your compiler is compatible with CUDA... -- Checking if you have the right version of cuDNN installed. -- Enabling CUDA support for dlib. DLIB WILL USE CUDA -- C++11 activated. -- Configuring done -- Generating done -- Build files have been written to: D:/fy/fs/faceswap_env/dlib-master

Clorr commented 6 years ago

Can you also post the version of python you are using with python --V

ByMark commented 6 years ago

python -V

Python 3.6.4

Clorr commented 6 years ago

Please reopen in faceswap-playground if still relevant