Stand on the shoulders of giants

[paper review] Denoising Diffusion Models for Plug-and-Play Image Restoration 본문

Paper reviews

[paper review] Denoising Diffusion Models for Plug-and-Play Image Restoration

finallyupper 2024. 8. 3. 11:20

본 논문에서는 diffusion sampling framework안에서 data term과 prior term을 나누어 반복적으로 해결해나감으로써 Image Restoration을 수행하고자한다.

  • data term = 다양한 degradation operator H를 사용해 다양한 degradation model들을 다룸
  • prior term = Plug-and-play denoiser prior로 off-the-shelf diffusion model을 사용

Summary

1. Introduction

Plug-and-play Image Restoration은 Alternating Direction Method of Multipliers(ADMM), HQS 과 같은 splitting algorithms 덕분에 iterative process에 Gaussian denoisers를 포함해 성능을 향상시킬 수 있게 되었다.

 

Plug-and-play IR methods의 main idea

아래 optimization problem을 data term과 prior term으로 쪼개고자 한다.

y : measurement of gt x0, y = H(x0) + n

σn : gaussian noise n의 iid std

H : degradation operator

  • 첫번째 term = degradation process를 따르도록 제한함
  • 두번째 term = solution이 desired data dist를 따르도록함.
    • Prior term은 gaussian denoisers로 implicit하게 해결 가능하다.
      • Traditional or CNN based discriminative Gaussian denoisers[29] Non-linear inverse problems에 대해 BM3D denoising operator를 사용해 prior subproblem을 해결함.
      • [58, 57] Deep denoiser priors를 처음으로 사용해 (traditional denoisers말고) 다양한 IR tasks들을 해결함. (cnn 기반)
      • [54] augmented Lagrangian function을 구축하고 다양한 image-denonising methods를 통해 ADMM을 사용
      • Deep generative models로 parameterized된 denoisers
        • ill-posed inverse problems를 더 잘 다룸 (더 complex한 dist를 다룰 수 있어서)
        • ex. GANs, NFs, VAEs
        • 그치만 얘네는 denoising task들을 위해 만들어진게 아니고 pnp prior로 사용할 경우 생성이 잘 안된다는 한계가 있었다.
      • Diffusion models
        • 정의
          • forward process에서 input data에 gaussian noise를 계속적으로 더해 perturb하고
          • reverse process에서 gradually remove gaussian noise를해서 이미지를 생성
        • 해당 모델들은 general한 inverse problems에서도 잘 작동함.
          • 예[38] image inpainting을 위한 iteration들을 resample하는 개선된 sampling strategy를 제안함.[7]ILVR - y로부터 low freqeuncy 정보를 가져와 data manifold로 보내기 위한 generation process의 guide로 사용
          • [32]DDRM - SVD를 사용해서 H의 spectral space에서 y에 있는 missing information들을 복원할 수 있는 diffusioni sampling을 수행
          • [8]DPS - Posterior sampling을 위해 Laplacian approximation을 사용(noisy non-linear inverse problems에도 적용 가능)
          • [49] single-image SR을 해결하기 위해 low-resolution imgs를 conditional inputs으로 사용한 conditional network를 구축함.
          그런데 얘네들은 low sampling speed나 hand-designed라는 한계점을 지님.

2. Background

1) Score-based diffusion models

Ito SDE

- Forward process

- Reverse process

score matching을 활용해 s_theta ~ 델타 log px(x)를 추정

== time t에서 noisy data xt에 대한 log prob. density (time dependenct score function)

⇒ 이때 s_theta(x_t, t)를 p_0t(xt|x0)가 gaussian인 상황에 대해 gaussian denoiser로 사용할 수 있다.

 

2) DDPMs

SDE에서 f(x,t)와 g(xt)를 할당하면 forward , reverse SDEs를 DDPM에서 Diffusion process의 “continuous version”으로 생각할 수 있게 된다.

- Forward step

이때 해당 forward 식은 total variance가 보존될 수 있도록 해서 VP SDE라고 불린다.

- Reverse step

  • epsilon = xt와 x0사이의 전체 noise를 예측하는 approximator

Score-based SDE와 DDPM의 연관성

  • DDPM의 Goal = x0에 더해진 노이즈를 학습
  • SDE의 Goal = score function 를 학습
  • 다음과 같이 근사해볼수 있음
    ⇒ 이제 diffusion models를 나타낼때 두개다 사용해볼수 있다!

 

DDIM

Diffusion models를 더 효율적으로 샘플링하게 해주는 방법론으로, diffusion process를 Markovian에서 non-Markovian으로 확장.

 

3) Conditional Diffusion models

= 해당 모델은 condition y가 주어질때 posterior distribution p(x|y)에서 이미지들을 샘플링하는 것이다.

 

아래 식에서 posterior distribution으로 바꿔서 쓰면, 결

델타 내 첫번째 텀은 unconditional pre-trained model, 두번재는 classifier가 된다.

해당 conditional generation은 unconditional pre-trained diffusion models로 업데이트한다음에 conditional information을 incorporate함으로써 사용할 수 있다.

 

3. Proposed Method

HQS algorithm을 이용해 data, prior term을 decouple함

auxilaiary variable z를 도입해 subprob들로 splict하고 iteratively solve

 

(10a) Prior= prior data dist 따르게 함

(10b) Data= y를 통해 image manifold를 좁힘 (둘다clean iomage manifold)

\mu = coefficient for the data-consistent constraint term. ← penalty term에 있는 constraint

  • goal = generative diff model들을 이용한 posterior sampling을 통해 inverse problems를 해결하자

 

1) Diffusion models as generative denoiser prior & Analytic Solution to Data Subproblem

간단하게 HQS alg에서 deep prior denoiser를 diffusion model으로 생각해볼 수 있다.

(10a) Prior와 diffusion process의 connection

 

3) DiffPIR Sampling

noisy version xt로부터 구한 x_0 hat의 추정치는 not accurate

그래서 DDIM처럼 Estimation-correction idea를 적용해서 noise level t-1로 add noise back (as in 12c)

 

* DDIM

: x_0hat 을 conditional distribution p(x|y)에서 sampling하고, effective predicted noise epision hat (xt, y)를 구해서 / 최종적인 one-step sampling expression을 (8)처럼 얻을 수 있다.

  • \hat{epsilon} = corrrected version of predicted noise
  • epsilon_t ~ N(0, 1)
  • 뒤에 마지막 noise term은 어처피 영향력이 미미할거라서 hyperparameter ζ를 도입해 두 노이즈의 balance를 맞춤. (=각 step에서 주입하는 노이즈의 양) 

 

4) Comparison to Related Works

DDRM

DDRM은 Linear inverse probelm을 svd를 통해 해결하고자하는 방법론이다.

DiffPIR과 마찬가지로 x0를 예측한 다음에 noise를 더해서 x_t-1을 샘플링한다는 점에서 구조적으로 유사하나 ddrm은 linear operator H에서만 작동한다는 점, 그리고 항상 svd 계산이 빠르게 된다는걸 보장하지 못한다는 한계가 있는데 diffpir은 임의의 degradation operator H에 대해 대응할 수 있다 ((13)식에 의해).

DPS

= laplace approximation을 이용해 posterior sampling의 intractability를 해결하고자 하는 시도.

 general inverse problems에 대해 DPS와 Diffpir이 비슷한 solution을 가진다.

그러나 문제점은 sampling speed가 느리고 sampling steps가 적을때는 복원이 잘 안된다는 것이다. 

또한,dps는 각 reverse diffusion step “이후”에 measurement를 다룬다는 점에서 diffpir은 reverse할때 y를 활용한다는 점에서 차이가 있고 DiffPIR이 훨씬 빠르게 sampling하는 것이 가능하다.

 

 

5) Accelerated Genearation Process

  1000 NFEs에 가까운 느린 inference speed가 diffusion models에 문제점인데, DDIM에서 제안한 바와 같이, DDPM을 non-Markovian diffusion process가 되도록 변형하여(training objective는 동일) 이를 해결하고자함.

그 reason은 denoising objective (4) (score matching)가 특정한 forward procedure에 의존하지 않기 때문에(p_0t가 고정된한) 

  따라서 학습에 사용된 [1, …, N] 전체가 아니라 subset만을 sampling sequence (길이 T)로 사용 가능하다는 것으로, 전체 과정 중 일부만 사용해도 원하는 결과를 얻을 수 있음.

⇒ 구체적으로 해당 논문에서는 DDIM의 quadratic sequence를 adapt해서 low noise regions에서 더욱 샘플링하도록 하여 더 나은 복원을 제공하고자 했다.)

 

 

4. Experiment

1) Implementation Details

- Dataset = FFHQ 256x256, ImageNet 256x256

- Degradation models

     - Inpainting

           - Box-type mask : 128x128 box region (=DPS)

           - Random-type mask : ½ * #pixels

           - Prepared-mask : Load masks used in RePaint

     - Gaussian blur

           - Blur kernel of size 61x61, std=3.0

           -  Motion blur : randomly generate 61x61 blur kernel, intensity=0.5 (=DPS)

    - Super Resolution

           - Bicubic downsampling

- Image inpainting은 noiseless case만 고려하고, Gaussian blur와 SR은 두 세팅 모두 고려함. 

 

2) Quantitative Experiments

- Metrics = PSNR, FID, LPIPS

- Compared with DDRM, DPS, DPIR

 

3) Qualitative Experiments

 

 

Ablation Study

Effect of sampling step

- PSNR은 NFE가 증가함에 따라 log-linear하게 증가했으나 LPIPS score의 경우 T ∈ [100, 500]에서 최소값을 보였다.

Effect of start sampling timestep

- CCDF와 비슷하게, reverse diffusion process를 partial noised image에서 시작해 실험해본 결과, t_start =400일때도 좋은 성능을 보였다.

 

Effect of Hyperparameters

● λ<1 ⇒ Noise is amplified (Strong Guidance)

● λ>1000 ⇒ More unconditional (Weak Guidance)

● ζ ~ 1 ⇒ More blurry

 

Conclusions

  • HQS-based diffusion sampling approach
  • off-the-shelf diffusi8on models 사용 (pnp deonising prior로)
  • clean image manifold에서 data subproblem을 solve

 

원문 https://arxiv.org/abs/2305.08995