zsyOAOA / DifFace

DifFace: Blind Face Restoration with Diffused Error Contraction (TPAMI, 2024)
Other
628 stars 42 forks source link

使用现有模型,测试,返回错误,如何解决? #8

Open fishboyzyf opened 1 year ago

fishboyzyf commented 1 year ago

python.exe D:\develop\DifFace\inference_difface.py --in_path D:\develop\DifFace\testdata\whole_imgs --out_path D:\data --gpu_id 0 Setting random seed 20000 Loading from ./weights/diffusion/iddpm_ffhq512_ema500000.pth... Loaded Done C:\Users**\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3191.) return _VF.meshgrid(tensors, *kwargs) # type: ignore[attr-defined] Loading from ./weights/SwinIR/General_Face_ffhq512.pth... Loaded Done C:\Users\\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( C:\Users***\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None. warnings.warn(msg) Traceback (most recent call last): File "D:\develop\DifFace\inference_difface.py", line 160, in main() File "D:\develop\DifFace\inference_difface.py", line 137, in main image_restored, face_restored, face_cropped = sampler_dist.sample_func_bfr_unaligned( File "D:\develop\DifFace\sampler.py", line 368, in sample_func_bfr_unaligned restored_faces = _process_batch(self.face_helper.cropped_faces) File "D:\develop\DifFace\sampler.py", line 332, in _process_batch restored_faces = self.sample_func_ir_aligned( File "D:\develop\DifFace\sampler.py", line 279, in sample_func_ir_aligned sample = self.diffusion.p_sample_loop( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 428, in p_sample_loop for sample in self.p_sample_loop_progressive( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 484, in p_sample_loop_progressive out = self.p_sample( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 383, in p_sample out = self.p_mean_variance( File "D:\develop\DifFace\models\respace.py", line 88, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), args, kwargs) File "D:\develop\DifFace\models\gaussian_diffusion.py", line 278, in p_mean_variance min_log = _extract_into_tensor( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 105, in _extract_into_tensor res = th.from_numpy(arr).to(device=timesteps.device)[timesteps].float() KeyboardInterrupt

chensming commented 1 year ago

python.exe D:\develop\DifFace\inference_difface.py --in_path D:\develop\DifFace\testdata\whole_imgs --out_path D:\data --gpu_id 0 Setting random seed 20000 Loading from ./weights/diffusion/iddpm_ffhq512ema500000.pth... Loaded Done C:\Users***\AppData\Local\Programs\Python\Python39\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3191.) return _VF.meshgrid(tensors, kwargs) # type: ignore[attr-defined] Loading from ./weights/SwinIR/General_Face_ffhq512.pth... Loaded Done C:\Users****\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead. warnings.warn( C:\Users_\AppData\Local\Programs\Python\Python39\lib\site-packages\torchvision\models_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None. warnings.warn(msg) Traceback (most recent call last): File "D:\develop\DifFace\inference_difface.py", line 160, in main() File "D:\develop\DifFace\inference_difface.py", line 137, in main image_restored, face_restored, face_cropped = sampler_dist.sample_func_bfr_unaligned( File "D:\develop\DifFace\sampler.py", line 368, in sample_func_bfr_unaligned restored_faces = _process_batch(self.face_helper.cropped_faces) File "D:\develop\DifFace\sampler.py", line 332, in _process_batch restored_faces = self.sample_func_ir_aligned( File "D:\develop\DifFace\sampler.py", line 279, in sample_func_ir_aligned sample = self.diffusion.p_sample_loop( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 428, in p_sample_loop for sample in self.p_sample_loop_progressive( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 484, in p_sample_loop_progressive out = self.p_sample( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 383, in p_sample out = self.p_mean_variance( File "D:\develop\DifFace\models\respace.py", line 88, in p_mean_variance return super().p_mean_variance(self._wrap_model(model), *args, **kwargs) File "D:\develop\DifFace\models\gaussian_diffusion.py", line 278, in p_mean_variance min_log = _extract_into_tensor( File "D:\develop\DifFace\models\gaussian_diffusion.py", line 105, in _extract_into_tensor res = th.from_numpy(arr).to(device=timesteps.device)[timesteps].float() KeyboardInterrupt

hi, bro, where did you download the ckpts?

zsyOAOA commented 1 year ago

Would you please share one of your testing images via email of zsyzam@gmail.com? I will have a try. The testing code runs normally on my testing environment. @fishboyzyf @chensming