yuanzhi-zhu / DiffPIR

"Denoising Diffusion Models for Plug-and-Play Image Restoration", Yuanzhi Zhu, Kai Zhang, Jingyun Liang, Jiezhang Cao, Bihan Wen, Radu Timofte, Luc Van Gool.
https://yuanzhi-zhu.github.io/DiffPIR/
MIT License
337 stars 25 forks source link

how to run Image Restoration Code? #9

Closed GluttonK closed 1 year ago

GluttonK commented 1 year ago

I am confused when I run the main_ddpir_sisr.py script, the generated result is images with noise. So how should the restoration code run?

yuanzhi-zhu commented 1 year ago

I am also confused, could you please provide more information on what did you do and the output of the program?

GluttonK commented 1 year ago

sure,I put my images into the directory demo_test ,and then run main_ddpir_sisr.py,here is the loginfo: `LogHandlers setup! 23-06-26 22:47:39.891 : model_name:256x256_diffusion_uncond, sr_mode:blur, image sigma:0.050, model sigma:0.050 23-06-26 22:47:39.899 : eta:0.000, zeta:0.100, lambda:1.000, guidance_scale:1.00 23-06-26 22:47:39.899 : start step:999, skip_type:quad, skip interval:10, skipstep analytic steps:0 23-06-26 22:47:39.899 : analytic iter num:1, gamma:0.01 23-06-26 22:47:39.899 : Model path: model_zoo\256x256_diffusion_uncond.pt 23-06-26 22:47:39.899 : testsets\demo_test Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off] Loading model from: E:\MyDevTool\Anaconda3\envs\diffpir\lib\site-packages\lpips\weights\v0.1\vgg.pth 23-06-26 22:47:40.966 : --------- sf:4 --k: 0 --------- 23-06-26 22:47:40.966 : eta:0.000, zeta:0.250, lambda:2.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:47:50.130 : ---1--> test.png -- sf:4 --k: 2 PSNR: 12.8824dB LPIPS: 0.6183 ave LPIPS: 0.6183 23-06-26 22:47:50.141 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.8824 dB 23-06-26 22:47:50.141 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 14.7567 dB 23-06-26 22:47:50.141 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6183 23-06-26 22:47:50.141 : eta:0.000, zeta:0.250, lambda:3.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:47:54.531 : ---1--> test.png -- sf:4 --k: 2 PSNR: 12.2704dB LPIPS: 0.6542 ave LPIPS: 0.6542 23-06-26 22:47:54.534 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.2704 dB 23-06-26 22:47:54.534 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 14.0044 dB 23-06-26 22:47:54.534 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6542 23-06-26 22:47:54.534 : eta:0.000, zeta:0.250, lambda:4.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:47:58.909 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.8896dB LPIPS: 0.6414 ave LPIPS: 0.6414 23-06-26 22:47:58.920 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.8896 dB 23-06-26 22:47:58.920 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.5462 dB 23-06-26 22:47:58.920 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6414 23-06-26 22:47:58.920 : eta:0.000, zeta:0.250, lambda:5.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:03.337 : ---1--> test.png -- sf:4 --k: 2 PSNR: 12.1002dB LPIPS: 0.6098 ave LPIPS: 0.6098 23-06-26 22:48:03.340 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.1002 dB 23-06-26 22:48:03.340 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.9410 dB 23-06-26 22:48:03.340 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6098 23-06-26 22:48:03.340 : eta:0.000, zeta:0.250, lambda:6.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:07.718 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.7106dB LPIPS: 0.6434 ave LPIPS: 0.6434 23-06-26 22:48:07.720 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.7106 dB 23-06-26 22:48:07.720 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.3292 dB 23-06-26 22:48:07.720 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6434 23-06-26 22:48:07.720 : eta:0.000, zeta:0.250, lambda:7.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:12.116 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.0532dB LPIPS: 0.6727 ave LPIPS: 0.6727 23-06-26 22:48:12.118 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.0532 dB 23-06-26 22:48:12.118 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.9173 dB 23-06-26 22:48:12.118 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6727 23-06-26 22:48:12.118 : eta:0.000, zeta:0.250, lambda:8.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:16.472 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.6819dB LPIPS: 0.6755 ave LPIPS: 0.6755 23-06-26 22:48:16.474 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.6819 dB 23-06-26 22:48:16.474 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.3525 dB 23-06-26 22:48:16.474 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6755 23-06-26 22:48:16.474 : eta:0.000, zeta:0.250, lambda:9.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:21.136 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.5264dB LPIPS: 0.6643 ave LPIPS: 0.6643 23-06-26 22:48:21.138 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.5264 dB 23-06-26 22:48:21.138 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.3192 dB 23-06-26 22:48:21.139 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6643 23-06-26 22:48:21.139 : eta:0.000, zeta:0.250, lambda:10.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:25.507 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.1463dB LPIPS: 0.6585 ave LPIPS: 0.6585 23-06-26 22:48:25.509 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.1463 dB 23-06-26 22:48:25.510 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.9433 dB 23-06-26 22:48:25.510 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6585 23-06-26 22:48:25.510 : eta:0.000, zeta:0.250, lambda:11.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:29.868 : ---1--> test.png -- sf:4 --k: 2 PSNR: 11.5699dB LPIPS: 0.6584 ave LPIPS: 0.6584 23-06-26 22:48:29.870 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 11.5699 dB 23-06-26 22:48:29.870 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 13.2914 dB 23-06-26 22:48:29.870 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6584 23-06-26 22:48:29.870 : eta:0.000, zeta:0.250, lambda:12.000, inIter:1.000, gamma:0.010, guidance_scale:1.00 23-06-26 22:48:34.267 : ---1--> test.png -- sf:4 --k: 2 PSNR: 12.5407dB LPIPS: 0.6429 ave LPIPS: 0.6429 23-06-26 22:48:34.270 : ------> Average PSNR(RGB) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 12.5407 dB 23-06-26 22:48:34.270 : ------> Average PSNR(Y) of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 14.2273 dB 23-06-26 22:48:34.270 : ------> Average LPIPS of (demo_test) scale factor: (4), kernel: (2) sigma: (0.050): 0.6429 23-06-26 22:48:34.270 : ------> Average PSNR of (demo_test) 11.8520 dB 23-06-26 22:48:34.270 : ------> Average PSNR-Y of (demo_test) 13.6026 dB 23-06-26 22:48:34.270 : ------> Average LPIPS of (demo_test) 0.6490

进程已结束,退出代码0 `

GluttonK commented 1 year ago

I wonder if I should set the save_L, save_E and save_LEH to True

yuanzhi-zhu commented 1 year ago

are your images similar to image_net data of ffhq data? and are they already low resolution images?

GluttonK commented 1 year ago

oh,I got it,in fact I want to use diffpir on images taken by drones. This seems infeasible currently,I look forward to training your model with my own dataset and thanks for your answer