wuhuikai / faceswap Goto Github PK
View Code? Open in Web Editor NEWSwap face between two photos.
Swap face between two photos.
NumPy v1.24 removed np.int, meaning that there is an error at runtime from following the install instructions.
Changing the instance of np.int
on line 24 of face_detection.py
to int
fixes the issue.
如何只替换部分区域,比如传入48到60就只替换嘴部的区域
Hi, I and my teammates @Acrylami and @david-osas are working on an open-source project and we found your project. We want to use the code to build core functionalities. Before proceeding, we want to ask for permission.
Please let us know if we can use FaceSwap by providing the credits.
Would it be ok to use this for my work-related project?
Hi, Developer.
Thank you for this great app.
I tried your app and work nicely.
When I was trying your app, sometimes --warp_2d
will give better result than without it.
The only issue that I found is --wrap_2d
uses "face" color tone instead of using "target" color tone which resulting inconsistent result color.
Is it possible for --wrap_2d
to also adjust the "face" color tone to follow "target" color tone?
Thanks
I see there a support to choose a face in a photo. How can we add this support in a video?
Take the simplest- Assuming the order of faces won't change, take an index as input and replace that index.
e.g. -index 2 replaces the 2nd face (from left to right). Or something similar.
[Asian-celeb dataset]
The dataset consists of the crawled images of celebrities on the he web.The ima images are covered under a Creative Commons Attribution-NonCommercial 4.0 International license (Please read the license terms here. e. http://creativecommons.org/licenses/by-nc/4.0/).
[train_msra.tar.gz]
MD5:c5b668f2204c400099b14f367069aef5
Content: Train dataset called MS-Celeb-1M-v1c with 86,876 ids/3,923,399 aligned images cleaned from MS-Celeb-1M dataset.
This dataset has been excluded from both LFW and Asian-Celeb.
Format: *.jpg
[msra_lmk.tar.gz]
MD5:7c053dd0462b4af243bb95b7b31da6e6
Content: A list of five-point landmarks for the 3,923,399 images in MS-Celeb-1M-v1c.
Format: .....
while is the path of images in tar file train_msceleb.tar.gz.
Label is an integer ranging from 0 to 86,875.
(x,y) is the coordinate of a key point on the aligned images.
left eye
right eye
nose tip
mouth left
mouth right
[train_celebrity.tar.gz]
MD5:9f2e9858afb6c1032c4f9d7332a92064
Content: Train dataset called Asian-Celeb with 93,979 ids/2,830,146 aligned images.
This dataset has been excluded from both LFW and MS-Celeb-1M-v1c.
Format: *.jpg
[celebrity_lmk.tar.gz]
MD5:9c0260c77c13fbb32692fc06a5dbfaf0
Content: A list of five-point landmarks for the 2,830,146 images in Asian-Celeb.
Format: .....
while is the path of images in tar file train_celebrity.tar.gz.
Label is an integer ranging from 86,876 to 196,319.
(x,y) is the coordinate of a key point on the aligned images.
left eye
right eye
nose tip
mouth left
mouth right
[testdata.tar.gz]
MD5:f17c4712f7562ea6d45f0a158e59b792
Content: Test dataset with 1,862,120 aligned images.
Format: *.jpg
[testdata_lmk.tar]
MD5:7e4995eb9976a2cfd2b23db05d76572c
Content: A list of five-point landmarks for the 1,862,120 images in testdata.tar.gz.
Features should be extracted in the same sequence and with the same amount with this list.
Format: .....
while is the path of images in tar file testdata.tar.gz.
(x,y) is the coordinate of a key point on the aligned images.
left eye
right eye
nose tip
mouth left
mouth right
[feature_tools.tar.gz]
MD5:227b069d7a83aa43b0cb738c2252dbc4
Content: Feature format transform tool and a sample feature file.
Format: We use the same format as Megaface(http://megaface.cs.washington.edu/) except that we merge all files into a single binary file.
Is there a link to any documentation on how the program works and an explanation of the code ?
Hello, I still can not understand the functionality of correct_colours
function in here . Can you explain it ?
Thanks.
Looking forward to your reply.
Here are the error messages when I was running the main.py in Linux
$ python3 main.py --src B.jpg --dst A.png --out result.jpg --correct_color
Traceback (most recent call last):
File "/home/hexinhu/FaceSwap/main.py", line 41, in
os.makedirs(dir_path)
File "/usr/lib/python3.10/os.py", line 225, in makedirs
mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
After install I get a SyntaxError for the default command:
python video_handler.py --src_img imgs/test7.jpg
python video_handler.py --src_img imgs/test7.jpg
File "video_handler.py", line 59
def run_face_swap(self, dst_img, dst_face_rect: dlib.rectangle):
^
SyntaxError: invalid syntax
pip install dlib
Requirement already satisfied: dlib in /home/***/anaconda2/lib/python2.7/site-packages (19.19
```.0)
Hi,
I don't know much about python.
I'm using OSX and have python and python3 available, also pip and pip3.
There is no instruction how to install dependencies and which version of python and pip is required.
Anyhow, I tried it this:
pip3 install -r requirements.txt
Collecting dlib==19.9.0 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/23/7a/891d4c46cdf755fb69eec0f06a53033d3754bf68ace5342ad56aeb540aa1/dlib-19.9.0.tar.gz
Collecting numpy==1.13.1 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/c0/3a/40967d9f5675fbb097ffec170f59c2ba19fc96373e73ad47c2cae9a30aed/numpy-1.13.1.zip
Collecting opencv==3.4.3.18 (from -r requirements.txt (line 14))
Could not find a version that satisfies the requirement opencv==3.4.3.18 (from -r requirements.txt (line 14)) (from versions: )
No matching distribution found for opencv==3.4.3.18 (from -r requirements.txt (line 14))
but as you see it failed.
Install it via pip3 install opencv-python
worked.
Then I removed opencv from requirements.txt file and tried again:
The output started with this
pip3 install -r requirements.txt
Collecting dlib==19.9.0 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/23/7a/891d4c46cdf755fb69eec0f06a53033d3754bf68ace5342ad56aeb540aa1/dlib-19.9.0.tar.gz
Collecting numpy==1.13.1 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/c0/3a/40967d9f5675fbb097ffec170f59c2ba19fc96373e73ad47c2cae9a30aed/numpy-1.13.1.zip
Collecting scipy==0.18.0 (from -r requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/01/a1/dce70d47377d662aa4b0895df8431aee92cea6faefaab9dae21b0f901ded/scipy-0.18.0.tar.gz
Building wheels for collected packages: dlib, numpy, scipy
Running setup.py bdist_wheel for dlib ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-5dbk1pv7/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-wheel-p9qb_qxu --python-tag cp37:
running bdist_wheel
running build
running build_py
package init file 'dlib/__init__.py' not found (or not a regular file)
running build_ext
Invoking CMake setup: 'cmake /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-5dbk1pv7/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-5dbk1pv7/dlib/build/lib.macosx-10.12-x86_64-3.7 -DPYTHON_EXECUTABLE=/usr/local/opt/python/bin/python3.7 -DCMAKE_BUILD_TYPE=Release'
error: [Errno 2] No such file or directory: 'cmake': 'cmake'
----------------------------------------
Failed building wheel for dlib
Running setup.py clean for dlib
Running setup.py bdist_wheel for numpy ... -
after a while it stopped with this output:
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.12-x86_64-3.7/build/src.macosx-10.12-x86_64-3.7/numpy/linalg/umath_linalg.o build/temp.macosx-10.12-x86_64-3.7/numpy/linalg/lapack_lite/python_xerbla.o -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.12-x86_64-3.7 -lnpymath -o build/lib.macosx-10.12-x86_64-3.7/numpy/linalg/_umath_linalg.cpython-37m-darwin.so -Wl,-framework -Wl,Accelerate
building 'numpy.random.mtrand' extension
compiling C sources
C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall
creating build/temp.macosx-10.12-x86_64-3.7/numpy/random
creating build/temp.macosx-10.12-x86_64-3.7/numpy/random/mtrand
compile options: '-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -c'
clang: numpy/random/mtrand/mtrand.c
numpy/random/mtrand/mtrand.c:44374:65: error: too many arguments to function call, expected 3, have 4
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include/stddef.h:105:16: note: expanded from macro 'NULL'
# define NULL ((void*)0)
^~~~~~~~~~
numpy/random/mtrand/mtrand.c:44793:21: error: no member named 'exc_type' in 'struct _ts'
*type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44794:22: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44795:19: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44802:24: error: no member named 'exc_type' in 'struct _ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44803:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44804:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44805:13: error: no member named 'exc_type' in 'struct _ts'
tstate->exc_type = type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44806:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44807:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44862:24: error: no member named 'exc_type' in 'struct _ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44863:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44864:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44865:13: error: no member named 'exc_type' in 'struct _ts'
tstate->exc_type = local_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44866:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44867:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
16 errors generated.
numpy/random/mtrand/mtrand.c:44374:65: error: too many arguments to function call, expected 3, have 4
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~
/Library/Developer/CommandLineTools/usr/lib/clang/9.0.0/include/stddef.h:105:16: note: expanded from macro 'NULL'
# define NULL ((void*)0)
^~~~~~~~~~
numpy/random/mtrand/mtrand.c:44793:21: error: no member named 'exc_type' in 'struct _ts'
*type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44794:22: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44795:19: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44802:24: error: no member named 'exc_type' in 'struct _ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44803:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44804:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44805:13: error: no member named 'exc_type' in 'struct _ts'
tstate->exc_type = type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44806:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44807:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44862:24: error: no member named 'exc_type' in 'struct _ts'
tmp_type = tstate->exc_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44863:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44864:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
numpy/random/mtrand/mtrand.c:44865:13: error: no member named 'exc_type' in 'struct _ts'
tstate->exc_type = local_type;
~~~~~~ ^
numpy/random/mtrand/mtrand.c:44866:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:237:15: note: 'curexc_value' declared here
PyObject *curexc_value;
^
numpy/random/mtrand/mtrand.c:44867:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:238:15: note: 'curexc_traceback' declared here
PyObject *curexc_traceback;
^
16 errors generated.
error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/private -Ibuild/src.macosx-10.12-x86_64-3.7/numpy/core/src/npymath -c numpy/random/mtrand/mtrand.c -o build/temp.macosx-10.12-x86_64-3.7/numpy/random/mtrand/mtrand.o -MMD -MF build/temp.macosx-10.12-x86_64-3.7/numpy/random/mtrand/mtrand.o.d" failed with exit status 1
----------------------------------------
Failed building wheel for numpy
Running setup.py clean for numpy
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
Running from numpy source directory.
`setup.py clean` is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add `--force` to your command to use it anyway if you must (unsupported).
----------------------------------------
Failed cleaning build dir for numpy
Running setup.py bdist_wheel for scipy ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-wheel-_exhtpet --python-tag cp37:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/scipy/setup.py", line 415, in <module>
setup_package()
File "/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/scipy/setup.py", line 395, in setup_package
from numpy.distutils.core import setup
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
Failed building wheel for scipy
Running setup.py clean for scipy
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
`setup.py clean` is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add `--force` to your command to use it anyway if you must (unsupported).
----------------------------------------
Failed cleaning build dir for scipy
Failed to build dlib numpy scipy
Installing collected packages: dlib, numpy, scipy
Running setup.py install for dlib ... error
Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-record-aaifzc0w/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
package init file 'dlib/__init__.py' not found (or not a regular file)
running build_ext
Invoking CMake setup: 'cmake /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/dlib/build/lib.macosx-10.12-x86_64-3.7 -DPYTHON_EXECUTABLE=/usr/local/opt/python/bin/python3.7 -DCMAKE_BUILD_TYPE=Release'
error: [Errno 2] No such file or directory: 'cmake': 'cmake'
----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/dlib/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-record-aaifzc0w/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q8/d_g_4vls0c1bg9q77gj621l80000gp/T/pip-install-d1ueaqyd/dlib/
When you run the script and close the upcomming debug image windows manually (by clicking the (x) or via the close context menu) the script is not stopping because its waiting for
cv2.waitKey(0)
Happens when detected face is out of bounds of the image.
Also, error in main_video.py line 55:
if not os.path.isdir(dir_path):
os.makedirs(dir_path)
Will output error if dir_path is ""
Edit:
if dir_path != "" and not os.path.isdir(dir_path):
os.makedirs(dir_path)
I am curious if there's a way for me to provide multiple source files and then have them be applied to faces in the dest image. The order doesn't really matter.
[root@vpc175 FaceSwap]# python main.py --src ./psb.jpg --dst ./sddefault.jpg --out ./out111.jpg ##--correct_color
Traceback (most recent call #last):
File "main.py", line 81, in
warped_src_face = warp_image_3d(src_face, src_points[:48], dst_points[:48], (w, h))
File "/opt/faceSwap/FaceSwap/face_swap.py", line 88, in warp_image_3d
process_warp(src_img, result_img, tri_affines, dst_points, delaunay)
File "/opt/faceSwap/FaceSwap/face_swap.py", line 60, in process_warp
result_img[y, x] = bilinear_interpolate(src_img, out_coords)
IndexError: index 223 is out of bounds for axis 1 with size 223
main.py, In select_face(), 47 line
im_w, im_h = im.shape[:2]
I think this must be wrong.
im_h , im_w = im.shape[:2]
In 52 line, So, It would change from
w, h = min(right+r, im_h)-x, min(bottom+r, im_w)-y
to
w, h = min(right+r, im_w)-x, min(bottom+r, im_h)-y
.
What do you think about that??
2.Without other op , simplely using seamlessClone
op for blending two face image like cv2.seamlessClone(src_img, dst_img, src_mask, center, cv2.NORMAL_CLONE)
, I test 3 cases:
a) When I use all white mask for src_mask
, there will be some white bright parts on the some edges of result face.
b) When I use the same-sized face white mask of src_img for src_mask
, there will be some bigger white bright parts on the some edges of result face.
c) When I use the eroded face white mask of src_img for src_mask
, there will be some black parts on the some edges of result face.
I can not find the causes and can not fix it. Can you give some advises?
Thanks.
Looking forward to your reply.
Hello and thank you for your great work !
I edited your code to get different result (replaced dlib detector to swap the eyebrows too...). My issue is that i want to use it on realtime videos, what do you think is the best solution to speed up ? is there a way to run it on GPU ? or there's another solution ?
Thank's again !
File "main.py", line 25, in
src_points, src_shape, src_face = select_face(src_img)
File "D:\2022waiba\ww\FaceSwap-master\face_detection.py", line 37, in select_face
bbox = faces[idx]
TypeError: Invalid index type
There is a error occour when I execute the command
python main.py --src imgs/test6.jpg --dst imgs/test7.jpg --out results/output6_7.jpg --correct_color
How can I fix it? thanks!
Is it possible to swap only part of the face (eg. mouth and nose region)?
Hi there,
I tried to run this code on an online notebook, and got the error message " cannot connect to X server ".
From what I understand it's because you're calling "cv2.imshow" at some point in your code. Is there a way to save the morphed image directly without displaying anything before that?
Hi,
I'm trying to improve upon your code and swapping algorithm. What are things to improve? Any future work you left unaddressed or can think of doing now?
Hello!
It's not issue, just small request.
Whether it is possible to make to impose brows?
For example
https://matthewearl.github.io/2015/07/28/switching-eds-with-python/
Thanks!
Hi,
I try to produce lots of images at once,
like codes below,but it seems it doesn't work,
How can I make it work? Thanks a lot
[in]:
import os
DOG = os.listdir("/content/drive/MyDrive/FaceSwap-master/dog")
for i in DOG:
!python main.py --src imgs/kage.jpg --dst DOG/i --out results/i --correct_color
[out]:
[ WARN:[email protected]] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('DOG/i'): can't open/read file: check file path/integrity
Traceback (most recent call last):
File "main.py", line 27, in
dst_faceBoxes = select_all_faces(dst_img)
File "/content/drive/MyDrive/FaceSwap-master/face_detection.py", line 74, in select_all_faces
faces = face_detection(im)
File "/content/drive/MyDrive/FaceSwap-master/face_detection.py", line 11, in face_detection
faces = detector(img, upsample_times)
TypeError: call(): incompatible function arguments. The following argument types are supported:
1. (self: _dlib_pybind11.fhog_object_detector, image: array, upsample_num_times: int=0) -> _dlib_pybind11.rectangles
Hi, it seems that the face does not scale proportionally when the size of the src (source) face and the dst (destination) face are different. Any idea how to improve this?
I can get the image in the output folder. So should I deal with it?
Traceback (most recent call last):
File "main.py", line 47, in <module>
cv2.imshow("From", dst_img)
cv2.error: OpenCV(4.6.0) C:\b\abs_f8n1j3l9l0\croot\opencv-suite_1691622637237\work\modules\highgui\src\window.cpp:1267: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
First off thanks for developing this as it works very well. I've been experimenting with face swapping on video (by running main.py on the n-th source video frame with the n-th destination video frame for all frames, where both videos have the same framerate) and am finding there is a flickering between frames due to the head positions being different. Here is an example result:
https://www.youtube.com/watch?v=YrNXIyn1Pgo
(Source video at https://www.youtube.com/watch?v=hxBgVnEjdVw and destination video at https://www.youtube.com/watch?v=Ob9ExceBitc)
Is it feasible to have this work for video where there is no flickering as in the result above?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.