Git Product home page Git Product logo

e4s's People

Contributors

e4s2022 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

e4s's Issues

The video swap is not consistent

Thanks for your excellent work. I ran face_swap for each frame in the video but found the results were not smooth.
But in your video demo, the results are very nice, could you please tell me how to fix it?
Thanks for your help!

Model license

Hello!

What is a model license?

Can I use it for commercial purpose?

Thanks!

Keeping images of source

How do you suggest modifying the code such that it keeps the expressions of the source image?

docker image

would anyone be so kind to make a docker image? unfortunately this is what I always end up resorting to, as for some reason everything crashes on both windows and ubuntu (wsl2). ive been trying to use this software for more than a week now, installing multiple torch/cudatoolkit versions to no avail.

Admin of the project, if youre reading this, please send me a message on telegram https://t.me/keronikateka

How to use it on my own images

Thank you for sharing such a wonderful project, but when I use FFHQ pre-trained weights to swap my own data, the result is very bad, please tell me how to do it if I want to swap my own images.

bad results on unseen data

Thanks for your work!
I wonder have you ever tried testing on the images that are not sampled from FFHQ? I test it on my daily images, and it returns bad results. (aligned faces are used and try on different resolution)

Error running example image

'''
Traceback (most recent call last):
File "e4s/scripts/face_swap.py", line 392, in
faceSwapping_pipeline(opts.source, opts.target, opts, save_dir=opts.output_dir,
File "python3.9/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "e4s/scripts/face_swap.py", line 314, in faceSwapping_pipeline
swapped_and_pasted = smooth_face_boundry(swapped_face_image, T, full_mask_image, radius=outer_dilation)
File "e4s/scripts/face_swap.py", line 95, in smooth_face_boundry
image_masked.putalpha(blurred_mask)
File "python3.9/site-packages/PIL/Image.py", line 1705, in putalpha
self.im.putband(alpha.im, band)
ValueError: images do not match
'''

Please assist. Thank you!

Error: pretrained model

Hi, when I tried swap face operation:

python scripts/face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg

the following error is reported:

Traceback (most recent call last):
  File "scripts/face_swap.py", line 345, in <module>
    generator, kp_detector, he_estimator, estimate_jacobian = init_facevid2vid_pretrained_model(face_vid2vid_cfg, face_vid2vid_ckpt)
  File "/root/project/e4s-main/./src/pretrained/face_vid2vid/driven_demo.py", line 216, in init_facevid2vid_pretrained_model
    generator, kp_detector, he_estimator = load_checkpoints(config_path=cfg_path, checkpoint_path=ckpt_path, gen="spade", cpu=False)
  File "/root/project/e4s-main/./src/pretrained/face_vid2vid/driven_demo.py", line 49, in load_checkpoints
    checkpoint = torch.load(checkpoint_path)
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 1049, in _load
    result = unpickler.load()
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 1019, in persistent_load
    load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "/root/miniconda3/envs/e4s/lib/python3.8/site-packages/torch/serialization.py", line 997, in load_tensor
    storage = zip_file.get_storage_from_record(name, numel, torch._UntypedStorage).storage()._untyped()
RuntimeError: PytorchStreamReader failed reading file data/94709563812016: invalid header or archive is corrupted

It seems to be related to the pre-trained model 00000189-checkpoint.pth.tar, but I downloaded it from the given link.
Can someone with a similar problem help me out?
Thanks.

The inference result is not good

The inference result is not good, is this a model that only works well for trained faces?

Result
source, target, result
스크린샷 2023-04-21 오전 10 10 10

Furthermore, The results you posted are also different from the result image of the paper.
Result
source, target, my result
image

Here is your result on paper
스크린샷 2023-04-21 오전 1 55 31

Please provide detailed answers on the above results.

checkpoint gone

hi , the weight link of 00000189-checkpoint.pth.tar in the facevid2vid paper is gone,can you send me a copy one? thank you very much! my email is [email protected]

RuntimeError: shape '[-1, 512, 8, 8]' is invalid for input of size 41472. error in CPU environment.

(e4s_env) [root@www e4s]# python face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg --device=cpu --checkpoint_path=/root/e4s/pretrained_ckpts/e4s/iteration_300000.pt --output_dir=/root/temp/ --verbose=True
Load face_vid2vid pre-trained model success!
Load GPEN pre-traiend model success!
Load pre-trained face parsing models success!
Load E4S pre-trained model success!
Traceback (most recent call last):
File "/root/e4s/face_swap.py", line 388, in
faceSwapping_pipeline(opts.source, opts.target, opts, save_dir=opts.output_dir,
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/root/e4s/face_swap.py", line 242, in faceSwapping_pipeline
driven_face, _ , structure_feats = net.gen_img(torch.zeros(1,512,32,32).to(opts.device), driven_style_codes, driven_onehot)
File "/root/e4s/src/models/networks.py", line 175, in gen_img
images, result_latent, structure_feats = self.G([style_codes], struc_codes, mask, input_is_latent=True,
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/e4s/src/models/stylegan2/model.py", line 640, in forward
out = conv1(out, latent[:, :, i], mask, noise=noise1)
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/e4s/src/models/stylegan2/model.py", line 396, in forward
out_i = self.conv(input, style[:, comp_i, :])
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/e4s/src/models/stylegan2/model.py", line 300, in forward
out = self.blur(out)
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/e4s/src/models/stylegan2/model.py", line 92, in forward
out = upfirdn2d(input, self.kernel, pad=self.pad)
File "/root/e4s/src/models/stylegan2/op/upfirdn2d.py", line 142, in upfirdn2d
out = UpFirDn2d.apply(
File "/root/e4s/e4s_env/lib64/python3.9/site-packages/torch/autograd/function.py", line 506, in apply
return super().apply(*args, **kwargs) # type: ignore[misc]
File "/root/e4s/src/models/stylegan2/op/upfirdn2d.py", line 118, in forward
out = out.view(-1, channel, out_h, out_w)
RuntimeError: shape '[-1, 512, 8, 8]' is invalid for input of size 41472

please suggest.
Thanks

checkpoint

The training process encountered No such file or directory: './pretrained_ckpts/auxiliray/model.pth' This checkpoint does not seem to be mentioned?

Can it be run on Windows?

I hope to be able to run it on Windows. I haven't tried it yet and I'm not sure if it can be successful.

Does the model work with PyTorch v2.x?

Hi, I was trying to run the demo with Pytorch v2.x. It seems that the swapped face is black.
When i switched the platform back to v1.x, it works.
Anyone had the same problem? Any suggestion to make this work with PT v2.x?

Thanks!

Can we run face swap with CPU and without GPU?

Hello,
I got this error : when I tried face swap.

Traceback (most recent call last):
File "/usr/lib64/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib64/python3.9/runpy.py", line 111, in _get_module_details
import(pkg_name)
File "/root/e4s/scripts/face_swap.py", line 17, in
from src.pretrained.face_parsing.face_parsing_demo import init_faceParsing_p retrained_model, faceParsing_demo, vis_parsing_maps
File "/root/e4s/src/pretrained/face_parsing/face_parsing_demo.py", line 13, in
from src.pretrained.face_parsing.model import BiSeNet, seg_mean, seg_std
File "/root/e4s/src/pretrained/face_parsing/model.py", line 15, in
seg_mean = torch.from_numpy(np.array([[0.485, 0.456, 0.406]])).float().cuda( ).reshape(1,3,1,1)
File "/usr/local/lib64/python3.9/site-packages/torch/cuda/init.py", line 2 47, in _lazy_init
torch._C._cuda_init()
RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.a spx

Please suggest if this can be used with CPU instead of GPU.
Thanks.

AttributeError: 'Editor' object has no attribute 'opt'

(e4s) root@autodl-container-fe7811a13c-a73d6848:~/autodl-tmp/FinegrainedFace/e4s# python face_edit.py --source=./example/input/faceedit/source.jpg --reference=./example/input/faceedit/reference.jpg --region hair eyes --alpha=1
Traceback (most recent call last):
File "face_edit.py", line 107, in
editor = Editor(opts)
File "face_edit.py", line 34, in init
self.faceParsing_model = init_faceParsing_pretrained_model(self.opts.faceParser_name, self.opt.faceParsing_ckpt, self.opt.segnext_config)
AttributeError: 'Editor' object has no attribute 'opt'

help v2

this time i tried in ubuntu using wsl2 and conda

(e4s) user@LAPTOP-E4D0U85P:~/e4s$ python scripts/face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1516, in _run_ninja_build
subprocess.run(
File "/home/user/miniconda3/envs/e4s/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "scripts/face_swap.py", line 16, in
from src.pretrained.gpen.gpen_demo import init_gpen_pretrained_model, GPEN_demo
File "/home/user/e4s/scripts/src/pretrained/gpen/gpen_demo.py", line 15, in
from src.pretrained.gpen.face_enhancement import FaceEnhancement
File "/home/user/e4s/scripts/src/pretrained/gpen/face_enhancement.py", line 11, in
from src.pretrained.gpen.face_model.face_gan import FaceGAN
File "/home/user/e4s/scripts/src/pretrained/gpen/face_model/face_gan.py", line 14, in
from src.pretrained.gpen.face_model.gpen_model import FullGenerator, FullGenerator_SR
File "/home/user/e4s/scripts/src/pretrained/gpen/face_model/gpen_model.py", line 16, in
from src.pretrained.gpen.face_model.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/home/user/e4s/scripts/src/pretrained/gpen/face_model/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/user/e4s/scripts/src/pretrained/gpen/face_model/op/fused_act.py", line 13, in
fused = load(
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 969, in load
return jit_compile(
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1176, in jit_compile
write_ninja_file_and_build_library(
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1280, in write_ninja_file_and_build_library
run_ninja_build(
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1538, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/user/.local/lib/python3.8/site-packages/torch/include -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/TH -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/THC -isystem /home/user/miniconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS
-D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/user/e4s/scripts/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
FAILED: fused_bias_act_kernel.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/user/.local/lib/python3.8/site-packages/torch/include -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/TH -isystem /home/user/.local/lib/python3.8/site-packages/torch/include/THC -isystem /home/user/miniconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/user/e4s/scripts/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
530 | operator=(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’
ninja: build stopped: subcommand failed.

(e4s) user@LAPTOP-E4D0U85P:~/e4s$ conda list

packages in environment at /home/user/miniconda3/envs/e4s:

Name Version Build Channel

_libgcc_mutex 0.1 main conda-forge
_openmp_mutex 5.1 1_gnu
blas 1.0 mkl conda-forge
brotlipy 0.7.0 py38h27cfd23_1003
bzip2 1.0.8 h7b6447c_0
ca-certificates 2023.01.10 h06a4308_0
certifi 2023.5.7 py38h06a4308_0
cffi 1.15.1 py38h5eee18b_3
charset-normalizer 2.0.4 pyhd3eb1b0_0
cryptography 39.0.1 py38h9ce1e76_0
cudatoolkit 11.1.74 h6bb024c_0 nvidia
dlib 19.24.0 py38he2161a6_0 conda-forge
ffmpeg 4.3 hf484d3e_0 pytorch
flit-core 3.8.0 py38h06a4308_0
freetype 2.12.1 h4a9f257_0
giflib 5.2.1 h5eee18b_3
gmp 6.2.1 h295c915_3
gnutls 3.6.15 he1e5248_0
idna 3.4 py38h06a4308_0
imageio 2.28.1 pypi_0 pypi
intel-openmp 2021.4.0 h06a4308_3561
jpeg 9e h5eee18b_1
lame 3.100 h7b6447c_0
lazy-loader 0.2 pypi_0 pypi
lcms2 2.12 h3be6417_0
ld_impl_linux-64 2.38 h1181459_1
lerc 3.0 h295c915_0
libblas 3.9.0 12_linux64_mkl conda-forge
libcblas 3.9.0 12_linux64_mkl conda-forge
libdeflate 1.17 h5eee18b_0
libffi 3.4.2 h6a678d5_6
libgcc-ng 11.2.0 h1234567_1
libgomp 11.2.0 h1234567_1
libiconv 1.16 h7f8727e_2
libidn2 2.3.2 h7f8727e_0
liblapack 3.9.0 12_linux64_mkl conda-forge
libpng 1.6.39 h5eee18b_0
libstdcxx-ng 11.2.0 h1234567_1
libtasn1 4.16.0 h27cfd23_0
libtiff 4.5.0 h6a678d5_2
libunistring 0.9.10 h27cfd23_0
libuv 1.44.2 h5eee18b_0
libwebp 1.2.4 h11a3e52_1
libwebp-base 1.2.4 h5eee18b_1
lz4-c 1.9.4 h6a678d5_0
mkl 2021.4.0 h06a4308_640
mkl-service 2.4.0 py38h7f8727e_0
mkl_fft 1.3.1 py38hd3c417c_0
mkl_random 1.2.2 py38h51133e4_0
ncurses 6.4 h6a678d5_0
nettle 3.7.3 hbbd107a_1
networkx 3.1 pypi_0 pypi
ninja 1.11.1 pypi_0 pypi
ninja-base 1.10.2 hd09550d_5
numpy 1.23.5 py38h14f4228_0
numpy-base 1.23.5 py38h31eccc5_0
opencv-python 4.7.0.72 pypi_0 pypi
openh264 2.1.1 h4ff587b_0
openssl 1.1.1t h7f8727e_0
packaging 23.1 pypi_0 pypi
pillow 9.4.0 py38h6a678d5_0
pip 23.0.1 py38h06a4308_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 23.0.0 py38h06a4308_0
pysocks 1.7.1 py38h06a4308_0
python 3.8.16 h7a1cb2a_3
python_abi 3.8 2_cp38 conda-forge
pytorch 1.8.2 py3.8_cuda11.1_cudnn8.0.5_0 pytorch-lts
pytorch-mutex 1.0 cuda pytorch
pywavelets 1.4.1 pypi_0 pypi
pyyaml 6.0 pypi_0 pypi
readline 8.2 h5eee18b_0
requests 2.28.1 py38h06a4308_1
scikit-image 0.20.0 pypi_0 pypi
scipy 1.9.1 pypi_0 pypi
setuptools 65.6.3 py38h06a4308_0
six 1.16.0 pyhd3eb1b0_1
sqlite 3.41.1 h5eee18b_0
tifffile 2023.4.12 pypi_0 pypi
tk 8.6.12 h1ccaba5_0
torch 1.10.1+cu113 pypi_0 pypi
torchaudio 0.10.1+cu113 pypi_0 pypi
torchvision 0.11.2+cu113 pypi_0 pypi
tqdm 4.65.0 pypi_0 pypi
typing_extensions 4.4.0 py38h06a4308_0
urllib3 1.26.15 py38h06a4308_0
wheel 0.38.4 py38h06a4308_0
xz 5.2.10 h5eee18b_1
zlib 1.2.13 h5eee18b_0
zstd 1.5.4 hc292b87_0

Getting Error: Maybe a CUDA Version + GCC Version Conflict?

What CUDA version and GCC version should I be using?

Testing inside Ubuntu latest with CUda 11.5 and GCC 11.3

Getting the following.

`raceback (most recent call last):
File "/home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
subprocess.run(
File "/home/g/anaconda3/envs/e4s/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "scripts/face_swap.py", line 16, in
from src.pretrained.gpen.gpen_demo import init_gpen_pretrained_model, GPEN_demo
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/gpen_demo.py", line 15, in
from src.pretrained.gpen.face_enhancement import FaceEnhancement
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_enhancement.py", line 11, in
from src.pretrained.gpen.face_model.face_gan import FaceGAN
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/face_gan.py", line 14, in
from src.pretrained.gpen.face_model.gpen_model import FullGenerator, FullGenerator_SR
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/gpen_model.py", line 16, in
from src.pretrained.gpen.face_model.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/op/fused_act.py", line 13, in
fused = load(
File "/home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
return jit_compile(
File "/home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1425, in jit_compile
write_ninja_file_and_build_library(
File "/home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1537, in write_ninja_file_and_build_library
run_ninja_build(
File "/home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1824, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/g/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
FAILED: fused_bias_act_kernel.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/g/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/g/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /media/g/PCXtend/1TB/AI/e4s/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
530 | operator=(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’
ninja: build stopped: subcommand failed.
`

CelebAHQ dataset incompatibility

The dataloader you've provided seem to be incompatible with the CelebAHQ dataset.
CelebAHQ dataset does not provide the segmentation mask as a whole, but rather in categories.
It is also divided into subfolders depending on the numbers of the image, from 0~14

화면 캡처 2023-04-24 142410

pythorch cuda problem.

/python3.8/site-packages/torch/cuda/init.py", line 190, in _lazy_init
torch._C._cuda_init()
RuntimeError: cuda runtime error (101) : invalid device ordinal at /pytorch/aten/src/THC/THCGeneral.cpp:47

No moduel named 'src'

(e4s) jack@jack-All-Series:~/e4s$ python scripts/face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg
Traceback (most recent call last):
  File "scripts/face_swap.py", line 15, in <module>
    from src.pretrained.face_vid2vid.driven_demo import init_facevid2vid_pretrained_model, drive_source_demo
ModuleNotFoundError: No module named 'src'
(e4s) jack@jack-All-Series:~/e4s$ 

for context I didn't install any of the optional repos but have downloaded the pre-trained facevid2vid model

Number of iterations for one A100

Due to limited computing resources, I use an A100 to train 300k on FFHQ, batch size = 2. The test effect is not good, how many iterations should be done when there is only one A100?The picture below is the test result:
question

help :)

I had to move the src folder inside scripts to fix paths

(e4s) C:\Users\user\e4s>python scripts/face_swap.py --source=example/input/faceswap/source.jpg --target=example/input/faceswap/target.jpg
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "scripts/face_swap.py", line 26, in
from src.models.networks import Net3
File "C:\Users\user\e4s\scripts\src\models\networks.py", line 8, in
from src.models.stylegan2.model import EqualLinear
File "C:\Users\user\e4s\scripts\src\models\stylegan2\model.py", line 11, in
from src.models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d, conv2d_gradfix
File "C:\Users\user\e4s\scripts\src\models\stylegan2\op_init_.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "C:\Users\user\e4s\scripts\src\models\stylegan2\op\fused_act.py", line 9, in
fused = load(
File "C:\Users\user\miniconda3\envs\e4s\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
return _jit_compile(
File "C:\Users\user\miniconda3\envs\e4s\lib\site-packages\torch\utils\cpp_extension.py", line 1509, in _jit_compile
_write_ninja_file_and_build_library(
File "C:\Users\user\miniconda3\envs\e4s\lib\site-packages\torch\utils\cpp_extension.py", line 1611, in _write_ninja_file_and_build_library
_write_ninja_file_to_build_library(
File "C:\Users\user\miniconda3\envs\e4s\lib\site-packages\torch\utils\cpp_extension.py", line 2048, in _write_ninja_file_to_build_library
_write_ninja_file(
File "C:\Users\user\miniconda3\envs\e4s\lib\site-packages\torch\utils\cpp_extension.py", line 2188, in _write_ninja_file
cl_paths = subprocess.check_output(['where',
File "C:\Users\user\miniconda3\envs\e4s\lib\subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\user\miniconda3\envs\e4s\lib\subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['where', 'cl']' returned non-zero exit status 1.

(e4s) C:\Users\user\e4s>conda list

packages in environment at C:\Users\user\miniconda3\envs\e4s:

Name Version Build Channel

blas 1.0 mkl
brotlipy 0.7.0 py38h2bbff1b_1003
ca-certificates 2023.01.10 haa95532_0
certifi 2023.5.7 py38haa95532_0
cffi 1.15.1 py38h2bbff1b_3
charset-normalizer 2.0.4 pyhd3eb1b0_0
colorama 0.4.6 pypi_0 pypi
contourpy 1.0.7 pypi_0 pypi
cryptography 39.0.1 py38h21b164f_0
cuda 12.1.1 0 nvidia
cuda-cccl 12.1.109 0 nvidia
cuda-command-line-tools 12.1.1 0 nvidia
cuda-compiler 12.1.1 0 nvidia
cuda-cudart 12.1.105 0 nvidia
cuda-cudart-dev 12.1.105 0 nvidia
cuda-cuobjdump 12.1.111 0 nvidia
cuda-cupti 12.1.105 0 nvidia
cuda-cuxxfilt 12.1.105 0 nvidia
cuda-demo-suite 12.1.105 0 nvidia
cuda-documentation 12.1.105 0 nvidia
cuda-libraries 12.1.1 0 nvidia
cuda-libraries-dev 12.1.1 0 nvidia
cuda-nsight-compute 12.1.1 0 nvidia
cuda-nvcc 12.1.105 0 nvidia
cuda-nvdisasm 12.1.105 0 nvidia
cuda-nvml-dev 12.1.105 0 nvidia
cuda-nvprof 12.1.105 0 nvidia
cuda-nvprune 12.1.105 0 nvidia
cuda-nvrtc 12.1.105 0 nvidia
cuda-nvrtc-dev 12.1.105 0 nvidia
cuda-nvtx 12.1.105 0 nvidia
cuda-nvvp 12.1.105 0 nvidia
cuda-opencl 12.1.105 0 nvidia
cuda-opencl-dev 12.1.105 0 nvidia
cuda-profiler-api 12.1.105 0 nvidia
cuda-runtime 12.1.1 0 nvidia
cuda-sanitizer-api 12.1.105 0 nvidia
cuda-toolkit 12.1.1 0 nvidia
cuda-tools 12.1.1 0 nvidia
cuda-visual-tools 12.1.1 0 nvidia
cudatoolkit 11.3.1 h59b6b97_2
cycler 0.11.0 pypi_0 pypi
filelock 3.9.0 py38haa95532_0
fonttools 4.39.4 pypi_0 pypi
freetype 2.12.1 ha860e81_0
giflib 5.2.1 h8cc25b3_3
idna 3.4 py38haa95532_0
importlib-resources 5.12.0 pypi_0 pypi
intel-openmp 2023.1.0 h59b6b97_46319
jinja2 3.1.2 py38haa95532_0
jpeg 9e h2bbff1b_1
kiwisolver 1.4.4 pypi_0 pypi
lerc 3.0 hd77b12b_0
libcublas 12.1.3.1 0 nvidia
libcublas-dev 12.1.3.1 0 nvidia
libcufft 11.0.2.54 0 nvidia
libcufft-dev 11.0.2.54 0 nvidia
libcurand 10.3.2.106 0 nvidia
libcurand-dev 10.3.2.106 0 nvidia
libcusolver 11.4.5.107 0 nvidia
libcusolver-dev 11.4.5.107 0 nvidia
libcusparse 12.1.0.106 0 nvidia
libcusparse-dev 12.1.0.106 0 nvidia
libdeflate 1.17 h2bbff1b_0
libffi 3.4.4 hd77b12b_0
libnpp 12.1.0.40 0 nvidia
libnpp-dev 12.1.0.40 0 nvidia
libnvjitlink 12.1.105 0 nvidia
libnvjitlink-dev 12.1.105 0 nvidia
libnvjpeg 12.2.0.2 0 nvidia
libnvjpeg-dev 12.2.0.2 0 nvidia
libnvvm-samples 12.1.105 0 nvidia
libpng 1.6.39 h8cc25b3_0
libtiff 4.5.0 h6c2663c_2
libuv 1.44.2 h2bbff1b_0
libwebp 1.2.4 hbc33d0d_1
libwebp-base 1.2.4 h2bbff1b_1
lz4-c 1.9.4 h2bbff1b_0
markupsafe 2.1.1 py38h2bbff1b_0
matplotlib 3.7.1 pypi_0 pypi
mkl 2023.1.0 h8bd8f75_46356
mkl-service 2.4.0 py38h2bbff1b_1
mkl_fft 1.3.6 py38hf11a4ad_1
mkl_random 1.2.2 py38hf11a4ad_1
mpmath 1.2.1 py38haa95532_0
networkx 2.8.4 py38haa95532_1
ninja 1.11.1 pypi_0 pypi
nsight-compute 2023.1.1.4 0 nvidia
numpy 1.24.3 py38h79a8e48_1
numpy-base 1.24.3 py38h8a87ada_1
openssl 1.1.1t h2bbff1b_0
pillow 9.4.0 py38hd77b12b_0
pip 23.0.1 py38haa95532_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 23.0.0 py38haa95532_0
pyparsing 3.0.9 pypi_0 pypi
pysocks 1.7.1 py38haa95532_0
python 3.8.16 h6244533_3
python-dateutil 2.8.2 pypi_0 pypi
pytorch-mutex 1.0 cpu pytorch
pyyaml 6.0 pypi_0 pypi
requests 2.29.0 py38haa95532_0
setuptools 66.0.0 py38haa95532_0
sqlite 3.41.2 h2bbff1b_0
sympy 1.11.1 py38haa95532_0
tbb 2021.8.0 h59b6b97_0
tk 8.6.12 h2bbff1b_0
torch 2.0.1+cu118 pypi_0 pypi
torchvision 0.15.2 py38_cpu pytorch
tqdm 4.65.0 pypi_0 pypi
typing_extensions 4.5.0 py38haa95532_0
urllib3 1.26.15 py38haa95532_0
vc 14.2 h21ff451_1
vs2015_runtime 14.27.29016 h5e58377_2
wheel 0.38.4 py38haa95532_0
win_inet_pton 1.1.0 py38haa95532_0
xz 5.4.2 h8cc25b3_0
zipp 3.15.0 pypi_0 pypi
zlib 1.2.13 h8cc25b3_0
zstd 1.5.5 hd43e919_0

Seems like something wrong with my C++ complier.

ERROR LOG:
ple/input/faceswap/target.jpg
Traceback (most recent call last):
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
subprocess.run(
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "scripts/face_swap.py", line 16, in
from src.pretrained.gpen.gpen_demo import init_gpen_pretrained_model, GPEN_demo
File "/home/hou/code/e4s-main/src/pretrained/gpen/gpen_demo.py", line 15, in
from src.pretrained.gpen.face_enhancement import FaceEnhancement
File "/home/hou/code/e4s-main/src/pretrained/gpen/face_enhancement.py", line 11, in
from src.pretrained.gpen.face_model.face_gan import FaceGAN
File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/face_gan.py", line 14, in
from src.pretrained.gpen.face_model.gpen_model import FullGenerator, FullGenerator_SR
File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/gpen_model.py", line 16, in
from src.pretrained.gpen.face_model.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/init.py", line 1, in
from .fused_act import FusedLeakyReLU, fused_leaky_relu
File "/home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_act.py", line 13, in
fused = load(
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
return jit_compile(
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1425, in jit_compile
write_ninja_file_and_build_library(
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1537, in write_ninja_file_and_build_library
run_ninja_build(
File "/home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1824, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/hou/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
FAILED: fused_bias_act_kernel.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/TH -isystem /home/hou/anaconda3/envs/e4s/lib/python3.8/site-packages/torch/include/THC -isystem /home/hou/anaconda3/envs/e4s/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' -std=c++14 -c /home/hou/code/e4s-main/src/pretrained/gpen/face_model/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o
/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘...’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘...’:
530 | operator=(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’
ninja: build stopped: subcommand failed.

Running environment:
gcc version 10.4.0 (Ubuntu 10.4.0-4ubuntu1~22.04)

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.