Git Product home page Git Product logo

ai-forever / ghost Goto Github PK

View Code? Open in Web Editor NEW
1.1K 26.0 220.0 94.01 MB

A new one shot face swap approach for image and video domains

License: Apache License 2.0

Python 41.36% Shell 0.31% Jupyter Notebook 18.17% C++ 22.46% Cuda 17.40% C 0.14% Makefile 0.03% CSS 0.07% HTML 0.03% Dockerfile 0.02%
computer-vision deep-learning deepfake faceswap pytorch deep-face-swap face-swap ghost ghost-faceswap ghost-swap

ghost's People

Contributors

alexandergroshev avatar danyache avatar kuznetsoffandrey avatar nastyamittseva avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ghost's Issues

Problem installing mxnet

$ py -m pip install mxnet
Collecting mxnet
Using cached mxnet-1.7.0.post2-py2.py3-none-win_amd64.whl (33.1 MB)
Collecting numpy<1.17.0,>=1.8.2
Using cached numpy-1.16.6.zip (5.1 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Collecting requests<2.19.0,>=2.18.4
Using cached requests-2.18.4-py2.py3-none-any.whl (88 kB)
Collecting graphviz<0.9.0,>=0.8.1
Using cached graphviz-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting certifi>=2017.4.17
Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting chardet<3.1.0,>=3.0.2
Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna<2.7,>=2.5
Using cached idna-2.6-py2.py3-none-any.whl (56 kB)
Collecting urllib3<1.23,>=1.21.1
Using cached urllib3-1.22-py2.py3-none-any.whl (132 kB)
Installing collected packages: urllib3, idna, chardet, numpy, graphviz, certifi, requests, mxnet
WARNING: The script chardetect.exe is installed in 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Attempting uninstall: numpy
Found existing installation: numpy 1.24.0
Uninstalling numpy-1.24.0:
Successfully uninstalled numpy-1.24.0
DEPRECATION: numpy is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at pypa/pip#8559
Running setup.py install for numpy: started
Running setup.py install for numpy: finished with status 'error'
error: subprocess-exited-with-error

Running setup.py install for numpy did not run successfully.
exit code: 1

[276 lines of output]
Running from numpy source directory.

Note: if you need reliable uninstall behavior, then install
with pip instead of using setup.py install:

- `pip install .`       (from a git repo or downloaded source
                         release)
- `pip install numpy`   (last NumPy release on PyPi)

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\misc_util.py:476: SyntaxWarning: "is" with a literal. Did you mean "=="?
return is_string(s) and ('*' in s or '?' is s)
blas_opt_info:
blas_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

blis_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blis not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

openblas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Found executable C:\Program Files\Git\usr\bin\DF.exe
Could not locate executable C:\Program
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
NOT AVAILABLE

atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

atlas_3_10_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

atlas_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

accelerate_info:
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\system_info.py:639: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\system_info.py:639: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
self.calc_info()
blas_src_info:
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\system_info.py:639: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
self.calc_info()
NOT AVAILABLE

'svnversion' is not recognized as an internal or external command,
operable program or batch file.
non-existing path in 'numpy\distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

openblas_lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

openblas_clapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas,lapack not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE

atlas_3_10_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE

atlas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE

lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack not found in ['C:\Users\Administrator\AppData\Local\Programs\Python\Python311\lib', 'C:\', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python311\libs']
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\system_info.py:639: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
self.calc_info()
lapack_src_info:
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Temp\pip-install-_vqy6jc2\numpy_50df99d6d0ce4aa7b689d7b0148eae3d\numpy\distutils\system_info.py:639: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
self.calc_info()
NOT AVAILABLE

C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools_distutils\dist.py:264: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running install
C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
creating build
creating build\src.win-amd64-3.1
creating build\src.win-amd64-3.1\numpy
creating build\src.win-amd64-3.1\numpy\distutils
building library "npymath" sources
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
Rolling back uninstall of numpy
Moving to c:\users\administrator\appdata\local\programs\python\python311\lib\site-packages\numpy-1.24.0.dist-info
from C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages~umpy-1.24.0.dist-info
Moving to c:\users\administrator\appdata\local\programs\python\python311\lib\site-packages\numpy
from C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages~umpy
Moving to c:\users\administrator\appdata\local\programs\python\python311\scripts\f2py.exe
from C:\Users\Administrator\AppData\Local\Temp\pip-uninstall-a_fvs93n\f2py.exe
error: legacy-install-failure

Encountered error while trying to install package.

numpy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

from coordinate_reg.image_infer import Handler => error

Hello ! When I run from coordinate_reg.image_infer import Handler:


OSError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_21280\3719535116.py in
----> 1 from coordinate_reg.image_infer import Handler

~\sber-swap\coordinate_reg\image_infer.py in
2 import numpy as np
3 import os
----> 4 import mxnet as mx
5 from skimage import transform as trans
6 import insightface

~\anaconda3\envs\original\lib\site-packages\mxnet_init_.py in
22 from future import absolute_import
23
---> 24 from .context import Context, current_context, cpu, gpu, cpu_pinned
25 from . import engine
26 from .base import MXNetError

~\anaconda3\envs\original\lib\site-packages\mxnet\context.py in
22 import warnings
23 import ctypes
---> 24 from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
25 from .base import _LIB
26 from .base import check_call

~\anaconda3\envs\original\lib\site-packages\mxnet\base.py in
211 version = libinfo.version
212 # library instance of mxnet
--> 213 _LIB = _load_lib()
214
215 # type definitions

~\anaconda3\envs\original\lib\site-packages\mxnet\base.py in _load_lib()
202 """Load library by searching possible path."""
203 lib_path = libinfo.find_lib_path()
--> 204 lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
205 # DMatrix functions
206 lib.MXGetLastError.restype = ctypes.c_char_p

~\anaconda3\envs\original\lib\ctypes_init_.py in init(self, name, mode, handle, use_errno, use_last_error)
354
355 if handle is None:
--> 356 self._handle = _dlopen(self._name, mode)
357 else:
358 self._handle = handle

OSError: [WinError 126] Не найден указанный модуль

AttributeError: module 'mxnet' has no attribute 'mod'

Trying to run the repo on Windows 10.
Installed mxnet-cu102-2.0.0b20201108.

The code execution stops on line 115 in image_infer.py file
model = mx.mod.Module(symbol=sym, context=ctx, label_names=None)

Full error: AttributeError: module 'mxnet' has no attribute 'mod'

Long Video

This project is great result at that pixel, but so sad its cant work with long video duration. Any plan to make it long ?

How to change mask height or exclude specific parts of face from swapping?

Hi! How to change mask height or exclude specific parts of face from swapping? There are situations when you need to exclude poorly or incorrectly formed parts of the face or cut the mask in width or height. Please, сan you tell me where in the code this can be changed? Thank you very much for your help!

Image of child's face

Even if I use a child's face image in Colab, it becomes Bad source images and I cannot exchange faces.

simswap mask

Hi guys, great job with the sber-swap implementation. The results are the best of any framework I've seen so far. The masking has been the only problem. Would it possible for you to implement anything similar to what Simswap has done for masking?

Bad source images

colab
does not detect some faces get "Bad source images"
the faces are jpg

r/local/lib/python3.7/dist-packages/torch/nn/functional.py:3680: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. 
  "The default behavior for interpolate/upsample with float scale_factor changed "
Bad source images
100%|██████████| 1/1 [00:00<00:00, 38.86it/s]
1it [00:00, 391.37it/s]
100%|██████████| 1/1 [00:00<00:00, 19.83it/s]
100%|██████████| 1/1 [00:00<00:00, 2481.84it/s]
1it [00:00,  6.08it/s]

Training issue

@AlexanderGroshev could you please discover a little details on how you train it?

  1. What batch size have you used and did you train it using only 1 GPU?
  2. What strategy of the training you had to obtain the shown in README results?

Cant install some the requiments

Igot this error message. whats seems to be the problem

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ghost\preprocess_vgg.py", line 5, in
from insightface_func.face_detect_crop_single import Face_detect_crop
File "C:\Users\Administrator\Desktop\ghost\insightface_func\face_detect_crop_single.py", line 8, in
from insightface.model_zoo import model_zoo
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\insightface_init_.py", line 16, in
from . import model_zoo
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\insightface\model_zoo_init_.py", line 1, in
from .model_zoo import get_model
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\insightface\model_zoo\model_zoo.py", line 11, in
from .arcface_onnx import *
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\insightface\model_zoo\arcface_onnx.py", line 10, in
import onnx
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\onnx_init_.py", line 20, in
import onnx.helper # noqa
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\onnx\helper.py", line 17, in
from onnx import mapping
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\onnx\mapping.py", line 27, in
int(TensorProto.STRING): np.dtype(np.object)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy_init_.py", line 284, in getattr
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'object'

ANd this

Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ghost\train.py", line 27, in
from utils.training.detector import detect_landmarks, paint_eyes
File "C:\Users\Administrator\Desktop\ghost\utils\training\detector.py", line 6, in
from AdaptiveWingLoss.utils.utils import get_preds_fromhm
ModuleNotFoundError: No module named 'AdaptiveWingLoss.utils'

TypeError: Descriptors cannot not be created directly.

Hi FaceSwap ! When I run this code:

python inference.py --source_paths {PATH_TO_IMAGE} --target_faces_paths {PATH_TO_IMAGE} --target_video {PATH_TO_VIDEO}

I have the following error:

TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Fine-Tuning on VGG Diverges

I've been attempting to fine-tune this model using the instructions provided, but the generated images seem to diverge after just a few thousand steps. See the attached image for generated samples
image

I've experimented with reducing/turning off all losses one-by-one. For example

Default - Diverges
weight_adv = 1
weight_attr = 10
weight_id = 20
weight_rec = 10
weight_eyes = 0

No Attr - Diverges
weight_adv = 1
weight_attr = 0
weight_id = 20
weight_rec = 10
weight_eyes = 0

No ID - Diverges
weight_adv = 1
weight_attr = 10
weight_id = 0
weight_rec = 10
weight_eyes = 0

No Reconstruction - Diverges
weight_adv = 1
weight_attr = 10
weight_id = 20
weight_rec = 0
weight_eyes = 0

The only run that produced decent results was when Adversarial loss was completely turned off. But turning off adversarial loss has it's own problems (see attached image)
weight_adv = 1
weight_attr = 10
weight_id = 20
weight_rec = 10
weight_eyes = 0

image

I've experimented with setting discr_force as True, this did not help produce good results.

I've experimented with reducing LR to 4e-5 (10% of default) and adding LR schedulers. This helped somewhat, but the model would still diverge after 10K-20K steps.

Was curious if you had any other suggestions - any help would be greatly appreciated!

Great work on this paper - very eager to see if we can fine-tuning to work so I can play around with some additional loss functions. I can keep sharing results here if that's helpful!

Typer Error on colab

Type Error on Colab In Inference Section, also the batch_size parameter Is highlighting as error

TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

Предложение по исправлению ошибок

К сожалению не умею правильно делать пулл-реквесты, поэтому прошу разработчиков поправить или сделать пулл-реквест @AlexanderGroshev

  1. В sberbank-ai/sber-swap/utils/inference/masks.py строка 7 lmrks = np.array( lmrks.copy(), dtype=np.int ) нужно исправить на lmrks = np.array( lmrks.copy(), dtype=np.int32) . Это уберёт предупреждения вроде Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations lmrks = np.array( lmrks.copy(), dtype=np.int ) которых реально чересчур много и которые сильно забивают полезный вывод в консоль.
  2. В sber-swap/utils/inference/video_processing.py строки 29 и 30 - в os.system(f"ffmpeg -i добавить -v -8, чтобы получилось os.system(f"ffmpeg -v -8 -i {video_with_sound} -vn... Это уберёт вывод работы FFmpeg и сделает вывод в консоль более чище и не будет забивать его лишней информацией.
  3. В sber-swap/utils/inference/video_processing.py строка 156 - исправить cv2.VideoWriter_fourcc(*'MP4V') на cv2.VideoWriter_fourcc(*'mp4v') - это решить проблему OpenCV: FFMPEG: tag 0x5634504d/'MP4V' и связанные с ней.

Остальное что нашёл в пулл-реквесте поправил @AlexanderGroshev. Спасибо!

Add ability to skip --target_faces_paths option

Hey! Thank you very much for the work done, we hope that the code will continue to be developed and finalized. There is one question. In the description of the --target_faces_paths option, you noted that you can skip this option and then any face in the photo or video will be selected. Unfortunately, the ability to choose whether to use a face from a screenshot or to automatically select any face does not work. If you skip this parameter, then there will always be an error (for a photo or video)

List of source paths:  ['/content/sber-swap/examples/images/elon_musk.jpg']
List of target paths:  ['examples/images/1.png', 'examples/images/2.png', 'examples/images/3.png']
Traceback (most recent call last):
  File "inference.py", line 153, in <module>
    main(args)
  File "inference.py", line 88, in main
    img = crop_face(img, app, args.crop_size)[0]
  File "/content/sber-swap/utils/inference/image_processing.py", line 16, in crop_face
    image, _ = app.get(image_full, crop_size)
  File "/content/sber-swap/insightface_func/face_detect_crop_multi.py", line 58, in get
    metric='default')
  File "/usr/local/lib/python3.7/dist-packages/insightface/model_zoo/scrfd.py", line 204, in detect
    im_ratio = float(img.shape[0]) / img.shape[1]
AttributeError: 'NoneType' object has no attribute 'shape'

You can skip this parameter only if you remove default=['examples/images/1.png', 'examples/images/2.png', 'examples/images/3.png'], nargs='+'. from it. But then, if necessary, the parameter itself will not work ... Add the ability to choose whether to use automatic face selection or from a screenshot from the video.

Привет! Спасибо большое за проделанную работу, надеемся что код и дальше будет развиваться и дорабатываться. Есть один вопрос. В описании опции --target_faces_paths вы отметили что можно пропустить эту опцию и тогда будет выбираться любое лицо на фото или видео. К сожалению возможность выбирать - использовать лицо со скриншота или чтобы автоматически выбиралось любое лицо (если оно всего одно например) не работает. Если скипнуть этот параметр то всегда (для фото или видео) будет ошибка. Скипнуть этот параметр можно только если убрать из него default=['examples/images/1.png', 'examples/images/2.png', 'examples/images/3.png'], nargs='+'. Но тогда если будет нужно - не будет работать сам параметр...Добавьте возможность выбирать, использовать автоматический выбор лица или со скриншота с видео.

IEEE Xplore

Hello! Please accept my congratulations on the publication on IEEE Xplore!) There have been no updates for a long time, do you plan to develop the repository further, or has it lost interest?

Stuck at Load Models

Stuck at:
input mean and std: 127.5 127.5
find model: ./insightface_func/models\antelope\glintr100.onnx recognition
find model: ./insightface_func/models\antelope\scrfd_10g_bnkps.onnx detection
set det-size: (640, 640)
loading ./coordinate_reg/model/2d106det 0
input mean and std: 127.5 127.5
find model: ./insightface_func/models\antelope\glintr100.onnx recognition
find model: ./insightface_func/models\antelope\scrfd_10g_bnkps.onnx detection
set det-size: (640, 640)

Tried both the inference.py and SberSwapInference.ipynb

I am on a windows machine with RTX 3070 ti

any way to improve faceswap video during close up?

I find the model is more effective in faceswap for video during medium or long-shots, but it really breaks down during close up shots (where the person's face takes up most of the screen).

Any advice on how to improve this?

I find that even when I increase inference rate to 60, it does not improve much.

Thanks!

which dataset is used to train the arcface model?

Hi, thanks for your sharing. I want to know which dataset is used to train the arcface model. And another question is that have you ever compared the results of using different identity extractor?

Dockerfile

Not an issue but I think this could come handy for someone :)

Dockerfile

FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04

RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa -y
RUN apt-get update && apt-get install -y \
    wget \
    python3.8 \
    python3.8-distutils \
    ffmpeg \
    libsm6 \
    libxext6

RUN wget https://bootstrap.pypa.io/get-pip.py

RUN python3.8 get-pip.py

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

python3.8 inference.py --target_path {PATH_TO_IMAGE} --image_to_image True

incorrect versions in requirements.txt

Hi FaceSwap,

Please state the correct versions in requirements.txt:

  • ERROR: Could not find a version that satisfies the requirement torch==1.6.0+cu101 (from versions: 1.7.1, 1.8.0, 1.8.1, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0, 1.12.1, 1.13.0)
    ERROR: No matching distribution found for torch==1.6.0+cu101
  • ERROR: Could not find a version that satisfies the requirement torchvision==0.7.0+cu101 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.8.2, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.11.1, 0.11.2, 0.11.3, 0.12.0, 0.13.0, 0.13.1, 0.14.0)
    ERROR: No matching distribution found for torchvision==0.7.0+cu101
  • ERROR: Could not find a version that satisfies the requirement onnxruntime-gpu==1.4.0 (from versions: none)
    ERROR: No matching distribution found for onnxruntime-gpu==1.4.0
  • ERROR: Could not find a version that satisfies the requirement mxnet-cu101mkl (from versions: none)
    ERROR: No matching distribution found for mxnet-cu101mkl
  • ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    conda-repo-cli 1.0.4 requires pathlib, which is not installed.
    anaconda-project 0.10.1 requires ruamel-yaml, which is not installed.

Make more cleaner console output without warnings

Hi! If possible, please correct the output of the result in the next update for a cleaner one! There are a lot of warnings that just clog up the useful output on the console. I didn't copy everything, the rest of the output (warnings) is identical. Thanks!

/usr/local/lib/python3.7/dist-packages/kornia/augmentation/augmentation.py:1833: DeprecationWarning: GaussianBlur is no longer maintained and will be removed from the future versions. Please use RandomGaussianBlur instead.
  category=DeprecationWarning,
/usr/local/lib/python3.7/dist-packages/scipy/fft/__init__.py:97: DeprecationWarning: The module numpy.dual is deprecated.  Instead of using dual, use the functions directly from numpy or scipy.
  from numpy.dual import register_func
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]
/usr/local/lib/python3.7/dist-packages/scipy/sparse/sputils.py:17: DeprecationWarning: `np.typeDict` is a deprecated alias for `np.sctypeDict`.
  supported_dtypes = [np.typeDict[x] for x in supported_dtypes]

and

Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 16% 46/289 [00:05<00:09, 25.51it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 17% 49/289 [00:05<00:09, 25.90it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 18% 52/289 [00:05<00:09, 26.29it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 19% 55/289 [00:05<00:08, 26.87it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 20% 58/289 [00:05<00:08, 27.16it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 21% 61/289 [00:05<00:08, 27.57it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 22% 64/289 [00:05<00:08, 25.83it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )
 23% 67/289 [00:05<00:08, 26.18it/s]/content/sber-swap/utils/inference/masks.py:7: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  lmrks = np.array( lmrks.copy(), dtype=np.int )

Video: face jitters

Hi,

I've tested the video swap functionality using the provided Colab, and in every test, the face "jitters". It looks like the scale of the face is changing by a very small amount. Sometimes the eyebrows are not aligned, either. So we have two copies of the eyebrows (in the instance that the original video raises their eyebrows).

Also, the mouth & eyes do not correctly match the source.

This video shows an example of the jittery face & eyes not pointing correctly.

sber.mp4

And this shows how the mouth should look in the source, how SimSwap correctly translates it, and how sber-swap does not have the correct eyes or mouth.

mouth

Are these issues with the approach, or would training the model for longer resolve the issues?

Failed to Run: Swap to Many Faces

I have tried to swap multi faces, here is the issue I have encountered. Please share thoughts, if anyone is able to replicate the issue or has fixed it.

python3 inference.py --source_paths multispecific/SRC_01.png multispecific/SRC_02.png multispecific/SRC_03.png --target_faces_paths multispecific/DST_01.jpg multispecific/DST_02.jpg multispecific/DST_03.jpg --target_videomultispecific/multi_3s.mp4  --out_video_name out.mp4
 
Traceback (most recent call last):
  File "inference.py", line 153, in <module>
    main(args)
  File "inference.py", line 104, in main
    BS=args.batch_size)
  File "/content/drive/MyDrive/sber-swap/utils/inference/core.py", line 63, in model_inference
    target_batch_rs = transform_target_to_torch(resized_frs, half=half)
  File "/content/drive/MyDrive/sber-swap/utils/inference/core.py", line 18, in transform_target_to_torch
    target_batch_rs = target_batch_rs[:, :, :, [2,1,0]]/255.
IndexError: too many indices for tensor of dimension 1

Unable to install: dependency conflict

Hi!

Firstly, thank you for sharing this project! It looks amazing.

Having some trouble with pip install -r requirements.txt

_ERROR: Cannot install -r requirements.txt (line 10), -r requirements.txt (line 12) and requests==2.25.1 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested requests==2.25.1
insightface 0.2.1 depends on requests
mxnet-cu101mkl 1.5.0 depends on requests<2.19.0 and >=2.18.4

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict_

Do you have any suggestion on how to fix this conflict? Have the wrong version numbers been added in requirements.txt, perhaps?

Looking forward to a solution. Thank you again!

run error in win10

i got this error "ModuleNotFoundError: No module named 'utils.inference'",when i run the commond
"python inference.py --source_paths "1.png" --target_image "mark.jpg" --image_to_image True"

could you elaborate more on the training configurations you used?

Hi, firstly, thanks for sharing this amazing project, it looks really promising!

I have some questions regarding the training configurations you used for your checkpoints. I'm new to deep learning and GANs, therefore if you could answer my questions as simple as possible I would be really grateful.

I was wondering how many epochs have you trained and how long it took in order to get to the checkpoints you achieved and if you think it's possible to improve the reconstruction result (sometimes the face in the target video and source picture is not exactly aligned, or there are both source and target eyebrows visible in the end result, or when the source person is bearded the beard is only half transferred to the target video). In addition, could you share the weights you used for adversarial loss, attributes, identity loss, reconstruction loss and eye loss and in what manner I could adjust these values in order to put more weight into source person and their eyes if possible?

Sorry for bombarding you with questions, thanks in advance!

Result = source

Running the colab example locally, I get this result:
result

As you can see, this is just the source image again with no swap. Here is my run log:
SBER Example.txt

Why is no actual swapping occurring?

Mxnet error . for no GPU

I cant get the versions working on my side. I tried some of the version but none of them working

File "C:\Users\Administrator\Desktop\Ghost\sber-swap\coordinate_reg\image_infer.py", line 4, in
import mxnet as mx
ModuleNotFoundError: No module named 'mxnet'

ANYONE HAS a solution for this error?

Blurry output

I have installed the project on windows and its working, but I noticed while my input images are both high resolution images, the swapped output face is quite blurry. It doesn't look similar to the example images. Is this a known issue, or is it is a matter of configuration? Any thoughts would be helpful.

OSError: libcudart.so.11.0

I am trying to run python inference.py but I am getting this error:

OSError: libcudart.so.11.0

I tried to first install Cuda toolkit version 10, given that requirements.txt focuses on that version. However, I got some errors around dll libraries, so I ran: pip install onnxruntime-gpu==1.8.0 mxnet-cu112==1.9.1. This worked fine for those errors but now I am getting this one: OSError: libcudart.so.11.0.

I tried then to install some nvidia dependencies using this command: sudo apt install nvidia-cuda-toolkit. But the error persists.

I am using a WSL environment / Ubuntu on Windows.

Are there some methods to approach this error? Am I missing a specific version for pytorch? I have this Cuda version: CUDA Version: 11.6.

Colab Type Error

Type Error on Colab In Inference Section

TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

Run swap on folder source/target images

Is there a way to run the swap on a folder of target/source images instead of specific pic-by-pic? This would make working with this repo a lot quicker and easier.

how to modify the model to support 512 resolution?

I'm experimenting other super resolution models instead of the pix2pix. However, this extra step is not necessary if the output is 512 resolution. Did anyone try to modify the model to output HD photos?

The HD training dataset is available, VGGface2HD, just like the simswap which support 512 resolution.

RTX 30xx cards

Hi,

Does anyone have a solution how to run this with RTX 30xx cards?

"d:\anaconda\envs\sber\lib\site-packages\torch\cuda_init_.py:125: UserWarning:
NVIDIA GeForce RTX 3070 with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37."

My understanding is that to use CUDA + 30xx cards, we need CUDA 11.x .... but then after installing Torch with Cuda 11, mxnet fails to load, since it isn't supported by Cuda 11.

So... is it even possible to run this using RTX 30xx series?

Torch dependency is not resolved

$ pip install -r requirements.txt 
Looking in links: https://download.pytorch.org/whl/torch_stable.html, https://download.pytorch.org/whl/torch_stable.html
Collecting numpy
  Using cached numpy-1.22.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
ERROR: Could not find a version that satisfies the requirement torch==1.6.0+cu101 (from versions: none)
ERROR: No matching distribution found for torch==1.6.0+cu101

Mouth is sometimes way too red

I've noticed that for some source image (private images, not for distribution or sharing), the reconstructed face has a mouth looking way too red. Have anyone seen the same effect and maybe found a way to correct it?

Could not find a version that satisfies the requirement torch==1.6.0+cu101

I have PyTorch CUDA 11.6 already installed, and cannot install older versions because of other projects. What do we do?

ERROR: Could not find a version that satisfies the requirement torch==1.6.0+cu101 (from versions: 1.7.1, 1.7.1+cpu, 1.7.1+cu101, 1.7.1+cu110, 1.8.0, 1.8.0+cpu, 1.8.0+cu101, 1.8.0+cu111, 1.8.1, 1.8.1+cpu, 1.8.1+cu101, 1.8.1+cu102, 1.8.1+cu111, 1.9.0, 1.9.0+cpu, 1.9.0+cu102, 1.9.0+cu111, 1.9.1, 1.9.1+cpu, 1.9.1+cu102, 1.9.1+cu111, 1.10.0, 1.10.0+cpu, 1.10.0+cu102, 1.10.0+cu111, 1.10.0+cu113, 1.10.1, 1.10.1+cpu, 1.10.1+cu102, 1.10.1+cu111, 1.10.1+cu113, 1.10.2, 1.10.2+cpu, 1.10.2+cu102, 1.10.2+cu111, 1.10.2+cu113, 1.11.0, 1.11.0+cpu, 1.11.0+cu113, 1.11.0+cu115, 1.12.0, 1.12.0+cpu, 1.12.0+cu113, 1.12.0+cu116, 1.12.1, 1.12.1+cpu, 1.12.1+cu113, 1.12.1+cu116, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117)
ERROR: No matching distribution found for torch==1.6.0+cu101

Anaconda

I have tried to use sberswap on anaconda with gpu and I found this issue! any suggestion?

Traceback (most recent call last):
File "inference.py", line 8, in
from utils.inference.image_processing import crop_face, get_final_image
File "/content/sber-swap/utils/inference/image_processing.py", line 10, in
from insightface.utils import face_align
File "/usr/local/lib/python3.8/site-packages/insightface/init.py", line 8, in
import onnxruntime
File "/usr/local/lib/python3.8/site-packages/onnxruntime/init.py", line 13, in
from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed,
File "/usr/local/lib/python3.8/site-packages/onnxruntime/capi/_pybind_state.py", line 9, in
import onnxruntime.capi._ld_preload # noqa: F401
File "/usr/local/lib/python3.8/site-packages/onnxruntime/capi/_ld_preload.py", line 12, in
_libcublas = CDLL("libcublas.so.10", mode=RTLD_GLOBAL)
File "/usr/local/lib/python3.8/ctypes/init.py", line 373, in init
self._handle = _dlopen(self._name, mode)
OSError: libcublas.so.10: cannot open shared object file: No such file or directory

Out of memory (Coom) repeatedly

Hey guys, wondering if anyone else is having this issue. Get up to about 43% and then get an coom error. Im using a 1650 with 4gbVram and 32gb Ram on a Linux laptop. Simswap works fine, but having an issue with this.

how to set the "weight_eyes"?

Dear sberbank-ai, I try to train on my datasets. and want to know how to set the weight_eyes? should I put 10 for weitght_eyes?

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.