Description
Recently my images have been generating masking artifacts around the face. These appear as random, small, overexposed squares around the face in the final image. After some troubleshooting, I found that the only way I can resolve the issue is by disabling "Default Use improved segmented mask (use pastenet to mask only the face) (requires restart)" in the settings.
I'm not sure the exact version, but the issue started for me on 8/6/2023. Issue happens with and without any post-processing.
Desktop (please complete the following information):
- OS: Windows 11 (22H2)
- Browser: Microsoft Edge
- FaceSwapLab: v1.2.1
- GPU: Nvidia RTX 3080 FE (10GB)
- Driver: v531.41
A1111 Info:
- A1111: v1.5.1
- Args: --xformers --autolaunch --medvram --update-check
- python: 3.10.6
- torch: 2.0.1+cu118
- xformers: 0.0.20
- gradio: 3.32.0
Additional context
2023-08-07 15:02:45,535 - FaceSwapLab - INFO - Try to use model : C:\A1111\stable-diffusion-webui\models\faceswaplab\inswapper_128.onnx
2023-08-07 15:02:45,540 - FaceSwapLab - INFO - Load analysis model det_size=(640, 640), det_thresh=0.5, providers = ['CUDAExecutionProvider'], will take some time. (> 30s)
Loading (640, 640) analysis model (first time is slow): 100%|█████████████████████████| 1/1 [00:00<00:00, 1.04model/s]
2023-08-07 15:02:46,502 - FaceSwapLab - INFO - ("Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'find model: '
'C:\A1111\stable-diffusion-webui\models\faceswaplab\analysers\models\buffalo_l\1k3d68.onnx '
"landmark_3d_68 ['None', 3, 192, 192] 0.0 1.0\n"
"Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'find model: '
'C:\A1111\stable-diffusion-webui\models\faceswaplab\analysers\models\buffalo_l\2d106det.onnx '
"landmark_2d_106 ['None', 3, 192, 192] 0.0 1.0\n"
"Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'find model: '
'C:\A1111\stable-diffusion-webui\models\faceswaplab\analysers\models\buffalo_l\det_10g.onnx '
"detection [1, 3, '?', '?'] 127.5 128.0\n"
"Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'find model: '
'C:\A1111\stable-diffusion-webui\models\faceswaplab\analysers\models\buffalo_l\genderage.onnx '
"genderage ['None', 3, 96, 96] 0.0 1.0\n"
"Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'find model: '
'C:\A1111\stable-diffusion-webui\models\faceswaplab\analysers\models\buffalo_l\w600k_r50.onnx '
"recognition ['None', 3, 112, 112] 127.5 127.5\n"
'set det-size: (640, 640)\n')
C:\A1111\stable-diffusion-webui\venv\lib\site-packages\insightface\utils\transform.py:68: FutureWarning: rcond
parameter will change to the default of machine precision times max(M, N)
where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass rcond=None
, to keep using the old, explicitly pass rcond=-1
.
P = np.linalg.lstsq(X_homo, Y)[0].T # Affine matrix. 3 x 4
2023-08-07 15:02:52,674 - FaceSwapLab - INFO - blend all faces together
2023-08-07 15:02:52,674 - FaceSwapLab - INFO - loading face Shelley.safetensors
2023-08-07 15:02:52,676 - FaceSwapLab - INFO - Process face 0
2023-08-07 15:02:52,681 - FaceSwapLab - INFO - Source Gender 0
Loading swap model: 100%|█████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.43model/s]
2023-08-07 15:02:53,381 - FaceSwapLab - INFO - ("Applied providers: ['CUDAExecutionProvider', 'CPUExecutionProvider'], with "
"options: {'CUDAExecutionProvider': {'do_copy_in_default_stream': '1', "
"'cudnn_conv_algo_search': 'EXHAUSTIVE', 'device_id': '0', "
"'gpu_external_alloc': '0', 'enable_cuda_graph': '0', 'gpu_mem_limit': "
"'18446744073709551615', 'gpu_external_free': '0', "
"'gpu_external_empty_cache': '0', 'arena_extend_strategy': 'kNextPowerOfTwo', "
"'cudnn_conv_use_max_workspace': '1', 'cudnn_conv1d_pad_to_nc1d': '0', "
"'tunable_op_enable': '0', 'tunable_op_tuning_enable': '0', "
"'enable_skip_layer_norm_strict_mode': '0'}, 'CPUExecutionProvider': {}}\n"
'inswapper-shape: [1, 3, 128, 128]\n')
2023-08-07 15:02:53,381 - FaceSwapLab - INFO - Target faces count : 1
2023-08-07 15:02:53,381 - FaceSwapLab - INFO - swap face 0
2023-08-07 15:02:56,468 - FaceSwapLab - INFO - ********************************************************************************
2023-08-07 15:02:56,468 - FaceSwapLab - INFO - Inswapper
2023-08-07 15:02:56,469 - FaceSwapLab - WARNING - Please note that improved mask does not work well without upscaling. Set upscaling to Lanczos at least if you want speed and want to use improved mask.
2023-08-07 15:02:56,469 - FaceSwapLab - INFO - improved_mask
2023-08-07 15:02:56,877 - FaceSwapLab - INFO - ********************************************************************************
2023-08-07 15:02:57,052 - FaceSwapLab - INFO - Finished processing image, return 1 images
2023-08-07 15:02:57,053 - FaceSwapLab - INFO - 1 images swapped
2023-08-07 15:02:57,054 - FaceSwapLab - INFO - Upscale with TGHQFace8x_500k scale = 1
2023-08-07 15:03:13,789 - FaceSwapLab - INFO - Restore face with GFPGAN
2023-08-07 15:03:16,034 - FaceSwapLab - INFO - Inpainting face
Sampler : DPM++ 2M SDE Karras
inpainting_denoising_strength : 0.03
inpainting_steps : 20
2023-08-07 15:03:16,034 - FaceSwapLab - INFO - send faces to image to image
2023-08-07 15:03:16,336 - FaceSwapLab - INFO - Denoising prompt : Portrait of a woman
2023-08-07 15:03:16,337 - FaceSwapLab - INFO - Denoising strenght : 0.03
0%| | 0/1 [00:01<?, ?it/s]
2023-08-07 15:03:18,239 - FaceSwapLab - ERROR - Failed to apply inpainting to face : local variable 'h' referenced before assignment
Traceback (most recent call last):
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_inpainting\i2i_pp.py", line 83, in img2img_diffusion
i2i_processed = processing.process_images(i2i_p)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 677, in process_images
res = process_images_inner(p)
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 794, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 1381, in sample
samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 434, in sample_img2img
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 303, in launch_sampling
return func()
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 434, in
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "C:\A1111\stable-diffusion-webui\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\A1111\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 650, in sample_dpmpp_2m_sde
h_last = h
UnboundLocalError: local variable 'h' referenced before assignment
2023-08-07 15:03:18,241 - FaceSwapLab - ERROR - Failed to post-process local variable 'h' referenced before assignment
Traceback (most recent call last):
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_postprocessing\postprocessing.py", line 44, in enhance_image
result_image = img2img_diffusion(
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_inpainting\i2i_pp.py", line 97, in img2img_diffusion
raise e
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-faceswaplab\scripts\faceswaplab_inpainting\i2i_pp.py", line 83, in img2img_diffusion
i2i_processed = processing.process_images(i2i_p)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 677, in process_images
res = process_images_inner(p)
File "C:\A1111\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack
return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 794, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "C:\A1111\stable-diffusion-webui\modules\processing.py", line 1381, in sample
samples = self.sampler.sample_img2img(self, self.init_latent, x, conditioning, unconditional_conditioning, image_conditioning=self.image_conditioning)
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 434, in sample_img2img
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 303, in launch_sampling
return func()
File "C:\A1111\stable-diffusion-webui\modules\sd_samplers_kdiffusion.py", line 434, in
samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args=extra_args, disable=False, callback=self.callback_state, **extra_params_kwargs))
File "C:\A1111\stable-diffusion-webui\venv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\A1111\stable-diffusion-webui\repositories\k-diffusion\k_diffusion\sampling.py", line 650, in sample_dpmpp_2m_sde
h_last = h
UnboundLocalError: local variable 'h' referenced before assignment
2023-08-07 15:03:18,244 - FaceSwapLab - INFO - Add swp image to processed
Activity