All projects

EE 475 Introduction to Image Processing · Fall 2025

Optimization-Based Approach to Blind Image Deblurring Using Dictionary Learning

Efe Karakoca & Taha Berk Koç (equal contribution)

  • Image Processing
  • Blind Deblurring
  • Dictionary Learning
  • ADMM

1Introduction

Image deblurring is concerned with various aspects of daily life ranging from daily photography to the medical imaging. Blur can stem from many sources such as measurement equipment (e.g. de-focus blur) or the motion during the exposure time. In order to address this imaging problem, a plethora of methods have been proposed including both classical [1] and deep-learning based methods [2]. Either classical or deep-learning based methods, many of existing studies rely on harnessing the statistical properties of the image and try to address this inverse problem using Bayesian approaches. The blur which is actuated on the image is usually modeled with the convolution y=x∗h+ny=x * h+n where xx is the clear image, hh is the blur kernel, nn denotes the noise, which eventually results in the blurred-noisy output yy. When both the hidden xx and the kernel hh is unknown, one of the most common way to find the optimal solution is to make use of MAP approach, trying to optimize the posterior distribution:

(x∗,h∗)=argmax⁡x,hp(x,h∣y)=argmax⁡x,hp(y∣x,h)p(x)p(h) \begin{aligned} \left(x^*, h^*\right) & =\underset{x, h}{\operatorname{argmax}} p(x, h \mid y) \\ & =\underset{x, h}{\operatorname{argmax}} p(y \mid x, h) p(x) p(h) \end{aligned}

However, as Levin [3] mentions, x=yx=y, h=δh=\delta solution is collapsed as a trivial one and no de-blurring occurs. To prevent this, we need to adjust the objective function so that this trivial solution is avoided.

The purpose of the project is to devise an algorithm that de-blurs the blurry image and obtain its clear version without having to know the blur kernel. The algorithm we have developed is based on initially estimating the blur kernel by learning the distribution of the kernel space and sampling from its posterior distribution, to initiate the multi-scale kernel estimation based on the proposition of Cho and Lee [4].

In order to better make use of the large dataset (whose details are mentioned in the Materials section), we learn a dictionary from the patches of clear images, which is claimed to represent the space where the clear images reside. This dictionary is then utilized to solve the constrained optimization problem that our methodology aligns with. In order to evade high dimensionality owing to the image size and large dataset, we make use of frequency space and sparse representations with online dictionary learning as proposed by Mairal in [5]. Our method incorporates various optimization techniques to build a structure that aims at resolving the de-blurring problem end-to-end.

Finally, we evaluate the performance of our model based on visual metrics depicting gradual evolution of our iterative algorithm and power distribution in the frequency domain of the clear/blurred and deblurred images

2Materials

The proper learning of blur kernel requires clear-blurred data pairs. There are many online available datasets to choose from such as  [6], [7]. The programming language to extract data and to run the algorithm is Python. Our focus is on [6] which includes clear image and clear-motion blur pairs.

Since, motion blur can vary more dramatically than the de-focus blur. Hence, motion blur can include more information and can capture individualistic differences, which are reflected on the motion blur kernels. Such a choice enabled us to use the proposition of Cho and Lee in their work [4].

3Methodology and Algorithm

3.1Estimating Blur Kernel

3.1.1Initial Estimation via Sampling From Posterior Kernel Distribution

We have our dataset pairs {(xmtr⁡,ymtr⁡)}m=1M\left\{\left(x_m^{\operatorname{tr}}, y_m^{\operatorname{tr}}\right)\right\}_{m=1}^M where yy is blurred and xx is sharp image. Patch size is p×pp \times p, kernel size is denoted by k×kk \times k. Vectorized kernel is h∈Rnhh \in \mathbb{R}^{n_h} with nh=k2n_h=k^2. Our goal is to build the prior of the kernel distribution based on those extracted from the paired dataset’s patches. To do so, on patches {(xm,j,ym,j)}j=1Jm,xm,j,ym,j∈Rp×p\left\{\left(x_{m, j}, y_{m, j}\right)\right\}_{j=1}^{J_m}, \quad x_{m, j}, y_{m, j} \in \mathbb{R}^{p \times p} we will try to minimize the loss function depending on the kernel as follows:

J(h)=12∥y−h∗x∥F2+λ2∥h∥F2. J(h)=\frac{1}{2}\|y-h * x\|_F^2+\frac{\lambda}{2}\|h\|_F^2 .

where

- yy : blurred image

- xx : sharp image

- hh : blur kernel (to be estimated)

- (*) : convolution

- ∥⋅∥F\|\cdot\|_F : Frobenius norm (ensuring invertibility)

Hence, for a patch we assume locally ym,j≈hm,j∗xm,jy_{m, j} \approx h_{m, j} * x_{m, j} convolution model.

X(ω)=F{x},Y(ω)=F{y},H(ω)=F{h} X(\omega)=\mathcal{F}\{x\}, \quad Y(\omega)=\mathcal{F}\{y\}, \quad H(\omega)=\mathcal{F}\{h\}
r=y−h∗x r=y-h * x
R(ω)=Y(ω)−H(ω)X(ω). R(\omega)=Y(\omega)-H(\omega) X(\omega) .

we will use the Parseval relation

∥r∥F2=∑i,j∣r[i,j]∣2∝∑ω∣R(ω)∣2=∑ω∣Y(ω)−H(ω)X(ω)∣2, \|r\|_F^2=\sum_{i, j}|r[i, j]|^2 \propto \sum_\omega|R(\omega)|^2=\sum_\omega|Y(\omega)-H(\omega) X(\omega)|^2,

and similarly

∥h∥F2=∑i,j∣h[i,j]∣2∝∑ω∣H(ω)∣2. \|h\|_F^2=\sum_{i, j}|h[i, j]|^2 \propto \sum_\omega|H(\omega)|^2 .
J(h)=12∑ω∣Y(ω)−H(ω)X(ω)∣2+λ2∑ω∣H(ω)∣2. J(h)=\frac{1}{2} \sum_\omega|Y(\omega)-H(\omega) X(\omega)|^2+\frac{\lambda}{2} \sum_\omega|H(\omega)|^2 .

frequency-wise approach:

J(h)=∑ωJω(H(ω)), J(h)=\sum_\omega J_\omega(H(\omega)),

where Jω(H)=12∣Y(ω)−HX(ω)∣2+λ2∣H∣2J_\omega(H)=\frac{1}{2}|Y(\omega)-H X(\omega)|^2+\frac{\lambda}{2}|H|^2.

for the complex derivative rules, to get the ideal expression for HH,

∂∂H∗(∣Y−HX∣2+λ∣H∣2)=(HX−Y)X∗+λH=0. \frac{\partial}{\partial H^*}\left(|Y-H X|^2+\lambda|H|^2\right)=(H X-Y) X^*+\lambda H=0 .

Optimal solution is then:

Hm,j(ω)=Ym,j(ω)Xm,j(ω)‾∣Xm,j(ω)∣2+λ H_{m, j}(\omega)=\frac{Y_{m, j}(\omega) \overline{X_{m, j}(\omega)}}{\left|X_{m, j}(\omega)\right|^2+\lambda}

We then enforce the PSF constraint

hm,j←max⁡(hm,j,0),hm,j←hm,j∑hm,j h_{m, j} \leftarrow \max \left(h_{m, j}, 0\right), \quad h_{m, j} \leftarrow \frac{h_{m, j}}{\sum h_{m, j}}

Now, we define the discrete posterior (dirac kernel buildup)

p(h)=∑i=1Nwiprior δ(h−hi),∑iwiprior =1 p(h)=\sum_{i=1}^N w_i^{\text {prior }} \delta\left(h-h_i\right), \quad \sum_i w_i^{\text {prior }}=1

where weights are based on an error function

Em,jdata=1p2∥y^m,j−ym,j∥22,Em,jreg=λ∥hm,j∥22, E_{m, j}^{\mathrm{data}}=\frac{1}{p^2}\left\|\hat{y}_{m, j}-y_{m, j}\right\|_2^2, \quad E_{m, j}^{\mathrm{reg}}=\lambda\left\|h_{m, j}\right\|_2^2,
ℓm,j=Em,jdata+Em,jreg. \ell_{m, j}=E_{m, j}^{\mathrm{data}}+E_{m, j}^{\mathrm{reg}} .

based on which we build Boltzmann weights as a natural choice

wiprior =exp⁡(−βtrℓ~i)∑j=1Nexp⁡(−βtrℓ~j) w_i^{\text {prior }}=\frac{\exp \left(-\beta_{\mathrm{tr}} \tilde{\ell}_i\right)}{\sum_{j=1}^N \exp \left(-\beta_{\mathrm{tr}} \tilde{\ell}_j\right)}

Then, we apply posterior update per test patch using feature similarity. From test blurred image y∗y^*, we extract non-overlapping patches {y∗(k)}k=1K\left\{y^*(k)\right\}_{k=1}^K for which we define a feature vector ϕk∗=ϕ(y∗(k))\phi_k^{*}=\phi\left(y^{*}(k)\right) where

ϕ=[RHL(y)b(y)μg(y)Var⁡(∣∇y∣)]∈R4 \phi=\left[\begin{array}{c} R_{H L}(y) \\ b(y) \\ \mu_g(y) \\ \operatorname{Var}(|\nabla y|) \end{array}\right] \in \mathbb{R}^4

where high/low radial power ratio RHLR_{HL} is defined RHL(y)=∑r(ω)>r0P(ω)∑r(ω)≤r0P(ω)+εR_{H L}(y)=\frac{\sum_{r(\omega)>r_0} P(\omega)}{\sum_{r(\omega) \leq r_0} P(\omega)+\varepsilon} with r0=0.25max⁡r(ω)r_0=0.25 \max r(\omega) and P(ω)=∣F{y}(ω)∣2P(\omega)=|\mathcal{F}\{y\}(\omega)|^2.

The other feature is slope of log-power vs radius log⁡P(r)≈a+br\log P(r) \approx a+b r and we store bb value.

The other features are related to the gradient information’s first two order statistics: μg(y)=E[∣∇y∣]\mu_g(y)=\mathbb{E}[|\nabla y|] and Var⁡(∣∇y∣)=V[∣∇y∣]\operatorname{Var}(|\nabla y|)=\mathbb{V}[|\nabla y|].

We use a gaussian-like similarity based likelihood:

p(ϕk∗∣hi)∝exp⁡(−γ∥ϕi−ϕk∗∥22) p\left(\phi_k^* \mid h_i\right) \propto \exp \left(-\gamma\left\|\phi_i-\phi_k^{*}\right\|_2^2\right)

Then the posterior is

p(h=hi∣ϕk∗)∝p(ϕk∗∣hi)p(h=hi) p\left(h=h_i \mid \phi_k^{*}\right) \propto p\left(\phi_k^{*} \mid h_i\right) p\left(h=h_i\right)
wi,kpost =wiprior exp⁡(−γdi,k2)∑j=1Nwjprior exp⁡(−γdj,k2) w_{i, k}^{\text {post }}=\frac{w_i^{\text {prior }} \exp \left(-\gamma d_{i, k}^2\right)}{\sum_{j=1}^N w_j^{\text {prior }} \exp \left(-\gamma d_{j, k}^2\right)}
p(h∣ϕk∗)=∑i=1Nwi,kpost δ(h−hi) p\left(h \mid \phi_k^*\right)=\sum_{i=1}^N w_{i, k}^{\text {post }} \delta\left(h-h_i\right)

Then we apply sampling from kernel density (KDE) based regularized posterior distribution to get posterior samples for each patch. Since we assume that the image is blurred by a single kernel, we average these candidates. The following algorithms depict this initialization step:

Algorithm 1: Stage 1A: Kernel Extraction, Reconstruction Loss, and Blur-Feature Computation
1:[H]
Input: Training pairs {(xmtr,ymtr)}m=1M\{(x^{\mathrm{tr}}_m, y^{\mathrm{tr}}_m)\}_{m=1}^M;
Patch size pp, kernel size kk; ridge parameter λ\lambda.
Output: Kernel set H\mathcal{H}, loss set L\mathcal{L}, feature set Φ\Phi.
2:Initialize H←∅\mathcal{H}\leftarrow\emptyset, L←∅\mathcal{L}\leftarrow\emptyset, Φ←∅\Phi\leftarrow\emptyset
3:for m=1,…,Mm=1,\dots,M do
4:Extract overlapping patches {(xm,j,ym,j)}j=1Jm\{(x_{m,j},y_{m,j})\}_{j=1}^{J_m}
5:for j=1,…,Jmj=1,\dots,J_m do
▷ 1.1 Kernel estimation via frequency inversion
6:Xm,j←F{xm,j}X_{m,j}\leftarrow\mathcal{F}\{x_{m,j}\}, Ym,j←F{ym,j}Y_{m,j}\leftarrow\mathcal{F}\{y_{m,j}\}
Hm,j(ω)=Ym,j(ω) Xm,j(ω)‾∣Xm,j(ω)∣2+λ H_{m,j}(\omega)= \frac{Y_{m,j}(\omega)\,\overline{X_{m,j}(\omega)}} {|X_{m,j}(\omega)|^{2}+\lambda}
7:Inverse FFT, center, crop ⇒hm,j∈Rk×k\Rightarrow h_{m,j}\in\mathbb{R}^{k\times k}
8:hm,j←max⁡(hm,j,0)h_{m,j}\leftarrow\max(h_{m,j},0), hm,j←hm,j/∑hm,jh_{m,j}\leftarrow h_{m,j}/\sum h_{m,j}
▷ 1.2 Patch reconstruction loss
9:y^m,j=hm,j∗xm,j\hat y_{m,j}=h_{m,j}*x_{m,j}
Em,jdata=1p2∥y^m,j−ym,j∥22,Em,jreg=λ∥hm,j∥22, E^{\mathrm{data}}_{m,j}=\frac{1}{p^{2}}\|\hat y_{m,j}-y_{m,j}\|_2^2, \qquad E^{\mathrm{reg}}_{m,j}=\lambda\|h_{m,j}\|_2^2,
ℓm,j=Em,jdata+Em,jreg. \ell_{m,j}=E^{\mathrm{data}}_{m,j}+E^{\mathrm{reg}}_{m,j}.
▷ 1.3 Four-dimensional blur feature vector
10:Power spectrum P=∣F{ym,j}∣2P=|\mathcal{F}\{y_{m,j}\}|^2, radial frequencies r(ω)r(\omega)
11:r0=0.25max⁡r(ω)r_0=0.25\max r(\omega)
RHL(ym,j)=∑r(ω)>r0P(ω)∑r(ω)≤r0P(ω)+ε R_{\mathrm{HL}}(y_{m,j})= \frac{\sum_{r(\omega)>r_0}P(\omega)} {\sum_{r(\omega)\le r_0}P(\omega)+\varepsilon}
12:Fit slope b(ym,j)b(y_{m,j}) from log⁡P(r)≈a+b r\log P(r)\approx a + b\,r
13:Compute gradient magnitude statistics:
μg(ym,j)=E[∣∇ym,j∣],Var(∣∇ym,j∣)=V[∣∇ym,j∣]. \mu_g(y_{m,j})=\mathbb{E}[|\nabla y_{m,j}|],\qquad \mathrm{Var}(|\nabla y_{m,j}|)=\mathbb{V}[|\nabla y_{m,j}|].
ϕm,j=[RHL(ym,j)b(ym,j)μg(ym,j)Var(∣∇ym,j∣)]∈R4. \phi_{m,j}= \begin{bmatrix} R_{\mathrm{HL}}(y_{m,j})\\ b(y_{m,j})\\ \mu_g(y_{m,j})\\ \mathrm{Var}(|\nabla y_{m,j}|) \end{bmatrix} \in\mathbb{R}^4.
14:Append hm,jh_{m,j}, ℓm,j\ell_{m,j}, ϕm,j\phi_{m,j} to H,L,Φ\mathcal{H},\mathcal{L},\Phi
15:Let N=∣H∣N=|\mathcal{H}| and index by hi,ℓi,ϕih_i,\ell_i,\phi_i
Algorithm 2: Stage 1B: Prior Weight Construction
1:[H]
Input: Losses {ℓi}i=1N\{\ell_i\}_{i=1}^N; prior scale βtr\beta_{\mathrm{tr}}.
Output: Prior weights {wiprior}i=1N\{w_i^{\mathrm{prior}}\}_{i=1}^N.
2:Shift losses:
ℓ~i=ℓi−min⁡jℓj. \tilde\ell_i=\ell_i-\min_j\ell_j.
3:Compute prior weights:
wiprior=exp⁡(−βtrℓ~i)∑jexp⁡(−βtrℓ~j). w_i^{\mathrm{prior}}= \frac{\exp(-\beta_{\mathrm{tr}}\tilde\ell_i)} {\sum_j\exp(-\beta_{\mathrm{tr}}\tilde\ell_j)}.
Algorithm 3: Stage 1C: KDE Bandwidth Computation
1:[H]
Input: Number of kernels NN; kernel dimension nh=k2n_h=k^2; bandwidth constant AA.
Output: KDE bandwidth hopth_{\mathrm{opt}}.
2:Compute:
hopt=A N−1/(nh+4). h_{\mathrm{opt}} = A\,N^{-1/(n_h+4)}.
Algorithm 4: Stage 2: Posterior Update and Jittered Sampling
1:[H]
Input: Test image y∗y^\ast; patch size pp; kernel size kk; feature scale γ\gamma;
Kernel set H\mathcal{H}, feature set Φ\Phi, prior weights wipriorw_i^{\mathrm{prior}},
KDE bandwidth hopth_{\mathrm{opt}}.
Output: Patch-level kernels {h~k}k=1K\{\tilde h_k\}_{k=1}^K.
2:Extract non-overlapping test patches {y(k)∗}k=1K\{y^\ast_{(k)}\}_{k=1}^K
3:for k=1,…,Kk=1,\dots,K do
4:Compute test feature vector ϕk∗\phi_k^\ast (same 4 components)
▷ Posterior weights
di,k2=∥ϕi−ϕk∗∥22,wi,kpost∝wipriore−γdi,k2. d_{i,k}^2=\|\phi_i-\phi_k^\ast\|_2^2, \qquad w_{i,k}^{\mathrm{post}} \propto w_i^{\mathrm{prior}} e^{-\gamma d_{i,k}^2}.
5:Normalize
▷ Weighted mean + covariance
μk=∑iwi,kposthi,Sk=∑iwi,kpost(hi−μk)(hi−μk)⊤+εI. \mu_k=\sum_i w_{i,k}^{\mathrm{post}}h_i, \qquad S_k=\sum_i w_{i,k}^{\mathrm{post}}(h_i-\mu_k)(h_i-\mu_k)^\top+\varepsilon I.
6:Compute Sk=DkDk⊤S_k=D_kD_k^\top
▷ Discrete ancestor + Gaussian jitter
7:Sample ak∼Categorical(w⋅,kpost)a_k\sim\mathrm{Categorical}(w^{\mathrm{post}}_{\cdot,k})
8:Draw εk∼N(0,Inh)\varepsilon_k\sim\mathcal{N}(0,I_{n_h})
h~k=hak+hoptDkεk. \tilde h_k=h_{a_k}+h_{\mathrm{opt}}D_k\varepsilon_k.
9:Reshape to k×kk\times k, enforce nonnegativity and sum-to-one
10:Store h~k\tilde h_k
Algorithm 5: Stage 3: Aggregate Patch Kernels
1:[H]
Input: Patch kernels {h~k}k=1K\{\tilde h_k\}_{k=1}^K.
Output: Final kernel h^\hat h.
h^=1K∑k=1Kh~k,h^←max⁡(h^,0),h^←h^/∑h^. \hat h=\frac{1}{K}\sum_{k=1}^K\tilde h_k, \qquad \hat h\leftarrow\max(\hat h,0), \quad \hat h\leftarrow\hat h/\sum\hat h.
Output: h^\hat h

3.1.2Fine Tune with Multi-Scale Kernel Estimation

Now that we have an initial estimate we make use of the proposition of Cho and Lee [4]. They solve this y=h∗x+Ny=h * x+N equation in alternating steps:

X′=argmin⁡X{∥Y−H∗X∥+ρX(X)},H′=argmin⁡H{∥Y−H∗X∥+ρH(H)}. \begin{aligned} X^{\prime} & =\operatorname{argmin}_X\left\{\|Y-H * X\|+\rho_X(X)\right\}, \\ H^{\prime} & =\operatorname{argmin}_H\left\{\|Y-H * X\|+\rho_H(H)\right\} . \end{aligned}

to which they integrate coarse-to-fine scheme. At the coarsest level, we use the down-sampled version of hh to initialize the process with the prediction step. After the final estimate of xx has been obtained at a coarse level, it is up-sampled by bilinear interpolation and then used for the input of the first prediction step at the next finer level.

Their prediction step consists of bilateral filtering, shock filtering, and gradient magnitude thresholding. They first apply bilateral filtering to the current estimate of XX to suppress possible noise and small details. A shock filter is then used to restore strong edges of XX. The result X′X^{\prime} of shock filtering contains not only high-contrast edges but also enhanced noise. We remove the noise by computing and thresholding the gradient maps {∂xX′,∂yX′}\left\{\partial_x X^{\prime}, \partial_y X^{\prime}\right\} of X′X^{\prime}. The truncated gradient maps {Px,Py}\left\{P_x, P_y\right\} give the final output of the prediction step.

Here are the mathematical steps:

We build a pyramid

B(s)=Resize⁡(Bfull ,s×s),s∈{32,64,128,256} B^{(s)}=\operatorname{Resize}\left(B_{\text {full }}, s \times s\right), \quad s \in\{32, 64, 128, 256\}

at the coarsest scale s=32s=32 we initialize L(32)←B(32)L^{(32)} \leftarrow B^{(32)} and the kernel k(5)k^{(5)} ( by posterior sample)

Then for each scale we : - Upsample LL to the new size

- Resize kernel to the new kernel size (5→9→17→33)(5 \rightarrow 9 \rightarrow 17 \rightarrow 33)

- Run NN iterations (e.g. 12 ) of Prediction → Kernel update → Latent update

Prediction

This is Cho-Lee’s "prediction step": bilateral smoothing, shock filtering and keep-only-strong-edges step. Bilateral filtering Xb=Bilateral⁡(X;σs,σr)X_b=\operatorname{Bilateral}\left(X ; \sigma_s, \sigma_r\right) reduces noise but preserves edges. Shock filter sharpens the edges X←X−sign⁡(ΔX)∣∇X∣ΔtX \leftarrow X-\operatorname{sign}(\Delta X)|\nabla X| \Delta t where ΔX\Delta X is the Laplacian and ∣∇X∣|\nabla X| is gradient magnitude. For the strong edge mask we calculate

gx=∂xXs,gy=∂yXs,g=gx2+gy2 g_x=\partial_x X_s, \quad g_y=\partial_y X_s, \quad g=\sqrt{g_x^2+g_y^2}

threshold τ\tau so that only a fraction of pixels survive:

M={(i,j):g(i,j)≥τ} \mathcal{M}=\{(i, j): g(i, j) \geq \tau\}
Px=gx⋅1M,Py=gy⋅1M P_x=g_x \cdot \mathbf{1}_{\mathcal{M}}, \quad P_y=g_y \cdot \mathbf{1}_{\mathcal{M}}

where Px,PyP_x, P_y (sparse derivative maps)

Kernel Update

We build the blurred derivatives ∂xY,∂yY,∂xxY,∂yyY,∂xyY\partial_x Y, \partial_y Y, \partial_{x x} Y, \partial_{y y} Y, \partial_{x y} Y and first and second order derivative pairs (Px,∂xY)\left(P_x, \partial_x Y\right) with weight w1w_1, (Py,∂yY)\left(P_y, \partial_y Y\right) with weight w1w_1 ,(∂xPx,∂xxY)\left(\partial_x P_x, \partial_{x x} Y\right) with weight w2w_2, (∂yPy,∂yyY)\left(\partial_y P_y, \partial_{y y} Y\right) weight w2w_2, (Pxy,∂xyY)\left(P_{x y}, \partial_{x y} Y\right) with weight w2w_2 where Pxy=12(∂xPy+∂yPx)P_{x y}=\frac{1}{2}\left(\partial_x P_y+\partial_y P_x\right).

The objective function is adopted as

min⁡k∑mwm∥Pm∗h−Ym∥22+β∥h∥22 \min _k \sum_m w_m\left\|P_m * h-Y_m\right\|_2^2+\beta\|h\|_2^2

where mm ranges over the 5 derivative channels, which yields a closed form solution in the frequency domain.

H^(ω)=∑mwmP^m‾Y^m∑mwm∣P^m∣2+β \hat{H}(\omega)=\frac{\sum_m w_m \overline{\hat{P}_m} \hat{Y}_m}{\sum_m w_m\left|\hat{P}_m\right|^2+\beta}

For the latent clear image estimation the objective function is

min⁡Xw0∥h∗X−Y∥22⏟DC anchor +w1∑d∈{x,y}∥h∗∂dX−∂dY∥22⏟1 st order +w2∑d∈{xx,yy,xy}∥h∗∂dX−∂dY∥22⏟2 nd order +α∥∇X∥22 \min _X \underbrace{w_0\|h * X-Y\|_2^2}_{\text {DC anchor }}+\underbrace{w_1 \sum_{d \in\{x, y\}}\left\|h * \partial_d X-\partial_d Y\right\|_2^2}_{1 \text { st order }}+\underbrace{w_2 \sum_{d \in\{x x, y y, x y\}}\left\|h * \partial_d X-\partial_d Y\right\|_2^2}_{2 \text { nd order }}+\alpha\|\nabla X\|_2^2

The ww values are adopted from the values presented in [8] as Cho and Lee did in their work. We can derive its closed-form update solution in frequency domain as follows:

Knowing that the derivative and the convolution has the following commutation relation: h∗(∂X)=(∂(h∗X))=(∂h)∗Xh *(\partial X)=(\partial(h * X))=(\partial h) * X. Let Dx^(ω)\widehat{D_x}(\omega) be the FFT of the derivative filter ∂x\partial_x (and the same notation for Dy,Dxx,…D_y, D_{x x}, \ldots which are easily derived by the finite difference in the discrete domain and hats denote the FT)

h∗∂xX^(ω)=h^(ω)∂xX^(ω)=H^(ω)Dx^(ω)X^(ω) \widehat{h * \partial_x X}(\omega)=\widehat{h}(\omega) \widehat{\partial_x X}(\omega)=\widehat{H}(\omega) \widehat{D_x}(\omega) \widehat{X}(\omega)

and eventually h∗∂xX−∂xY^(ω)=Dx^(ω)(H^(ω)X^(ω)−Y^(ω))\widehat{h * \partial_x X-\partial_x Y}(\omega)=\widehat{D_x}(\omega)(\widehat{H}(\omega) \widehat{X}(\omega)-\widehat{Y}(\omega))

and h∗X−Y^(ω)=H^(ω)X^(ω)−Y^(ω)\widehat{h * X-Y}(\omega)=\widehat{H}(\omega) \widehat{X}(\omega)-\widehat{Y}(\omega). We use the Parseval relation: ∥Z∥22∝∑ω∣Z^(ω)∣2\|Z\|_2^2 \propto \sum_\omega|\widehat{Z}(\omega)|^2

Hence the objective function (or as known as cost function) becomes

Jω(X)=W∣HX−Y∣2+αM1∣X∣2 J_\omega(X)=W|H X-Y|^2+\alpha M_1|X|^2

where

W(ω)=w0+w1M1(ω)+w2M2(ω)M1(ω)=∣Dx∣2+∣Dy∣2,M2(ω)=∣Dxx∣2+∣Dyy∣2+∣Dxy∣2 \begin{gathered} W(\omega)=w_0+w_1 M_1(\omega)+w_2 M_2(\omega) \\ M_1(\omega)=\left|D_x\right|^2+\left|D_y\right|^2, \quad M_2(\omega)=\left|D_{x x}\right|^2+\left|D_{y y}\right|^2+\left|D_{x y}\right|^2 \end{gathered}

Optimization with respect to the clear image XX follows a straightforward procedure of element-wise (for each frequency ww as done previously) optimization:

Jω(X)=W(HX−Y)(HˉXˉ−Yˉ)+αM1XXˉ J_\omega(X)=W(H X-Y)(\bar{H} \bar{X}-\bar{Y})+\alpha M_1 X \bar{X}

Using the properties ∂∂Xˉ(XXˉ)=X\frac{\partial}{\partial \bar{X}}(X \bar{X})=X and ∂∂Xˉ(HˉXˉ)=Hˉ\frac{\partial}{\partial \bar{X}}(\bar{H} \bar{X})=\bar{H}

∂Jω∂Xˉ=W(HX−Y)⋅Hˉ+αM1X \frac{\partial J_\omega}{\partial \bar{X}}=W(H X-Y) \cdot \bar{H}+\alpha M_1 X
WHˉ(HX−Y)+αM1X=0 W \bar{H}(H X-Y)+\alpha M_1 X=0
(W∣H∣2+αM1)X=WHˉY \left(W|H|^2+\alpha M_1\right) X=W \bar{H} Y
X=WHˉYW∣H∣2+αM1 X=\frac{W \bar{H} Y}{W|H|^2+\alpha M_1}

Thus,

X^(ω)=H^(ω)‾Y^(ω)W(ω)∣H^(ω)∣2W(ω)+αM1(ω) \widehat{X}(\omega)=\frac{\overline{\widehat{H}(\omega)} \widehat{Y}(\omega) W(\omega)}{|\widehat{H}(\omega)|^2 W(\omega)+\alpha M_1(\omega)}

3.2Dictionary Learning

Dictionary learning plays a fundamental role in our pipeline. Based on a large dataset and their patches, we can learn a representation by dictionary whose elements are rich enough to construct any clear patch in ideal scenario. Our large dataset and its patches provide us with a sufficient amount so that the elements of the dictionary can be combined (by so-called "atoms").

Dictionary will come into play in our objective function as a constraint when learning the clear latent image and this constraint will enforce the reconstruction to comply with the space of the clear images. Here are the details of how to learn such a representation.

Now we switch to vectorized form and for images of size Himg×WimgH_{\mathrm{img}} \times W_{\mathrm{img}}, let M=HimgWimgM=H_{\mathrm{img}} W_{\mathrm{img}}.

- Clean image variable

zx∈RM (vectorized clean image)  z_x \in \mathbb{R}^M \text { (vectorized clean image) }

- Observed blurred image

zy∈RM (vectorized blurry image; data)  z_y \in \mathbb{R}^M \text { (vectorized blurry image; data) }

We represent the clean image as zx=Dzαz_x=D_z \alpha where D corresponds the dictionary. We determine it before starting our main algorithm. They can be hand-crafted linear transforms ( such as discrete cosine transform (DCT), Wavelet Transform Coefficients) or learned with the optimization:

min⁡D,{αi}∑∥xi−Dαi∥22+λ∥αi∥1 s.t. ∥dj∥2=1 \min _{D,\left\{\alpha_i\right\}} \sum\left\|x_i-D \alpha_i\right\|_2^2+\lambda\left\|\alpha_i\right\|_1 \quad \text { s.t. } \quad\left\|d_j\right\|_2=1

However, the issue is that when our sample size increases, the ZZ matrix gets large (used through the algorithm). In order to deal with the high dimensionality, we propose to use the patch version, whose formalism is as follows:

We know that zx∈RMz_x \in \mathbb{R}^M and we extract the patch as pℓ=Pℓzx∈Rnpp_{\ell}=P_{\ell} z_x \in \mathbb{R}^{n_p} where np=p2n_p=p^2 for p∗pp*p patch. We will try to learn the dictionary on the patches as: pℓ≈Dαℓp_{\ell} \approx D \alpha_{\ell}

In order to fuse these patches back, we apply the following optimization, aiming at the estimated fusion minimizes L2L_2 error:

min⁡zF(z):=∑ℓ=1L∥Pℓz−rℓ∥22,rℓ:=Dαℓ fixed  \min _z F(z):=\sum_{\ell=1}^L\left\|P_{\ell} z-r_{\ell}\right\|_2^2, \quad r_{\ell}:=D \alpha_{\ell} \text { fixed }
F(z)=∑ℓ(z⊤Pℓ⊤Pℓz−2z⊤Pℓ⊤rℓ+rℓ⊤rℓ) F(z)=\sum_{\ell}\left(z^{\top} P_{\ell}^{\top} P_{\ell} z-2 z^{\top} P_{\ell}^{\top} r_{\ell}+r_{\ell}^{\top} r_{\ell}\right)
F(z)=z⊤(∑ℓPℓ⊤Pℓ)z−2z⊤(∑ℓPℓ⊤rℓ)+ constant with respect to z  F(z)=z^{\top}\left(\sum_{\ell} P_{\ell}^{\top} P_{\ell}\right) z-2 z^{\top}\left(\sum_{\ell} P_{\ell}^{\top} r_{\ell}\right)+\text { constant with respect to z }

Re-expressing:

F(z)=z⊤Az−2z⊤b+cons F(z)=z^{\top} A z-2 z^{\top} b+\mathrm{cons}

where,

A:=∑ℓPℓ⊤Pℓ,b:=∑ℓPℓ⊤r A:=\sum_{\ell} P_{\ell}^{\top} P_{\ell}, \quad b:=\sum_{\ell} P_{\ell}^{\top} r
∇zF(z)=0⟹2Az−2b=0 \nabla_z F(z)=0 \quad \Longrightarrow \quad 2 A z-2 b=0
Az=b⟹z=A−1b A z=b \quad \Longrightarrow \quad z=A^{-1} b

Hence, the reconstruction is based on:

z∗=(∑ℓPℓ⊤Pℓ)−1(∑ℓPℓ⊤rℓ)=(∑ℓPℓ⊤Pℓ)−1(∑ℓPℓ⊤Dαℓ). z^*=\left(\sum_{\ell} P_{\ell}^{\top} P_{\ell}\right)^{-1}\left(\sum_{\ell} P_{\ell}^{\top} r_{\ell}\right)=\left(\sum_{\ell} P_{\ell}^{\top} P_{\ell}\right)^{-1}\left(\sum_{\ell} P_{\ell}^{\top} D \alpha_{\ell}\right) .

where W=∑ℓPℓ⊤PℓW=\sum_{\ell} P_{\ell}^{\top} P_{\ell} and hence z=W−1∑ℓPℓ⊤Dαℓz=W^{-1} \sum_{\ell} P_{\ell}^{\top} D \alpha \ell

The properties of WW is as follows:

PℓP_\ell is such a matrix that it has only a single 1 entry at each row:

(Pℓ⊤Pℓ)ij=∑m=1np(Pℓ)mi(Pℓ)mj. \left(P_{\ell}^{\top} P_{\ell}\right)_{i j}=\sum_{m=1}^{n_p}\left(P_{\ell}\right)_{m i}\left(P_{\ell}\right)_{m j} .

Hence, for i≠ji \neq j : every term in the sum is 0.

(Pℓ⊤Pℓ)ii={1 if pixel i belongs to patch ℓ0 otherwise . \left(P_{\ell}^{\top} P_{\ell}\right)_{i i}= \begin{cases}1 & \text { if pixel } i \text { belongs to patch } \ell \\ 0 & \text { otherwise } .\end{cases}

Knowing that

W:=∑ℓ=1LPℓ⊤Pℓ.Wij=∑ℓ(Pℓ⊤Pℓ)ij. \begin{aligned} W:= & \sum_{\ell=1}^L P_{\ell}^{\top} P_{\ell .} \\ W_{i j}= & \sum_{\ell}\left(P_{\ell}^{\top} P_{\ell}\right)_{i j .} \end{aligned}

and due to diagonality:

Wii=∑ℓ(Pℓ⊤Pℓ)i W_{i i}=\sum_{\ell}\left(P_{\ell}^{\top} P_{\ell}\right)_i

Therefore WiiW_{i i} counts how many patches include pixel i.

Conceptually:

α=[α1α2⋮αL]∈RKL \alpha=\left[\begin{array}{c} \alpha_1 \\ \alpha_2 \\ \vdots \\ \alpha_L \end{array}\right] \in \mathbb{R}^{K L}
Dz α=W−1∑ℓ=1LPℓ⊤(Dαℓ) D_{\text {z }} \alpha=W^{-1} \sum_{\ell=1}^L P_{\ell}^{\top}\left(D \alpha_{\ell}\right)
Dz =W−1[P1⊤DP2⊤D⋯PL⊤D]∈RM×(KL) D_{\text {z }}=W^{-1}\left[\begin{array}{llll} P_1^{\top} D & P_2^{\top} D & \cdots & P_L^{\top} D \end{array}\right] \in \mathbb{R}^{M \times(K L)}

but as we will see, we won’t need to store the large Dz D_{\text {z }} matrix.

These WW and PP may look large matrices but in code implementation, we don’t need to store the explicit matrices, index slicing will be harnessed.

To deal with large number of extracted patches, we can use online dictionary learning proposed in [5]. They gradually learn the dictionary as new data arrives based on the following algorithm, adopted directly from the reference paper:

Algorithm 6: Online dictionary learning.
Require: x∈Rm∼p(x)\mathbf{x} \in \mathbb{R}^m \sim p(\mathbf{x}) (random variable and an algorithm to draw i.i.d samples of pp), λ∈R\lambda \in \mathbb{R} (regularization parameter), D0∈Rm×k\mathbf{D}_0 \in \mathbb{R}^{m \times k} (initial dictionary), TT (number of iterations).
1:A0∈Rk×k←0\mathbf{A}_0 \in \mathbb{R}^{k \times k} \gets 0, B0∈Rm×k←0\mathbf{B}_0 \in \mathbb{R}^{m \times k} \gets 0 (reset the “past” information).
2:for t=1t = 1 to TT do
3:Draw xt\mathbf{x}_t from p(x)p(\mathbf{x}).
4:Sparse coding: compute using Coordinate Descent
αt≜arg⁡min⁡α∈Rk12∥xt−Dt−1α∥22+λ∥α∥1. \boldsymbol{\alpha}_t \triangleq \arg\min_{\boldsymbol{\alpha} \in \mathbb{R}^k} \frac{1}{2}\|\mathbf{x}_t - \mathbf{D}_{t-1}\boldsymbol{\alpha}\|_2^2 + \lambda \|\boldsymbol{\alpha}\|_1.
5:At←At−1+αtαtT.\mathbf{A}_t \gets \mathbf{A}_{t-1} + \boldsymbol{\alpha}_t \boldsymbol{\alpha}_t^{T}.
6:Bt←Bt−1+xtαtT.\mathbf{B}_t \gets \mathbf{B}_{t-1} + \mathbf{x}_t \boldsymbol{\alpha}_t^{T}.
7:Compute Dt\mathbf{D}_t using Algorithm 2, with Dt−1\mathbf{D}_{t-1} as warm restart, so that
Dt≜arg⁡min⁡D∈C1t∑i=1t(12∥xi−Dαi∥22+λ∥αi∥1) \mathbf{D}_t \triangleq \arg\min_{\mathbf{D} \in \mathcal{C}} \frac{1}{t} \sum_{i=1}^t \left( \frac{1}{2} \|\mathbf{x}_i - \mathbf{D}\boldsymbol{\alpha}_i\|_2^2 + \lambda\|\boldsymbol{\alpha}_i\|_1 \right)
=arg⁡min⁡D∈C1t(12Tr(DTDAt)−Tr(DTBt)).(6) = \arg\min_{\mathbf{D} \in \mathcal{C}} \frac{1}{t}\left( \frac{1}{2}\mathrm{Tr}(\mathbf{D}^T \mathbf{D} \mathbf{A}_t) - \mathrm{Tr}(\mathbf{D}^T \mathbf{B}_t) \right). \tag{6}
8:end for
9:return DT\mathbf{D}_T (learned dictionary).
Algorithm 7: Dictionary Update.
Require: D=[d1,…,dk]∈Rm×k\mathbf{D} = [\mathbf{d}_1, \ldots, \mathbf{d}_k] \in \mathbb{R}^{m \times k} (input dictionary), A=[a1,…,ak]∈Rk×k\mathbf{A} = [\mathbf{a}_1, \ldots, \mathbf{a}_k] \in \mathbb{R}^{k \times k}, B=[b1,…,bk]∈Rm×k\mathbf{B} = [\mathbf{b}_1, \ldots, \mathbf{b}_k] \in \mathbb{R}^{m \times k}
1:repeat
2:for j=1j = 1 to kk do
3:Update the jj-th column to optimize for (6):
uj←1A[j,j](bj−Daj)+dj, \mathbf{u}_j \gets \frac{1}{\mathbf{A}[j,j]} \left( \mathbf{b}_j - \mathbf{D}\mathbf{a}_j \right) + \mathbf{d}_j,
dj←1max⁡(∥uj∥2,1) uj.(7) \mathbf{d}_j \gets \frac{1}{\max(\|\mathbf{u}_j\|_2,1)} \, \mathbf{u}_j. \tag{7}
4:end for
5:until convergence
6:return D\mathbf{D} (updated dictionary).

3.3Inference

We can consider the preparation step as the training stage since we learn the optimal DD and HH based on the data pairs we have. Having learned these components, now we analyze the inference (i.e. what should be done when a new blurry image arrives at our model)

We assume that the vectorized noisy version is based on the zy≈Hzxz_y \approx H z_x transformation where

HH is conceptually M×MM \times M

Hzx=vec⁡(h∗X),X=reshape⁡(zx)∈RHimg×Wimx H z_x=\operatorname{vec}(h * X), \quad X=\operatorname{reshape}\left(z_x\right) \in \mathbb{R}^{H_{\mathrm{img}} \times W_{\mathrm{im} x}}

The optimization will include zx,αz_x,\alpha

3.3.1Fixed HH and DD

Our objective function is

min⁡zx,α12∥zy−Hzx∥22+λ∥α∥1 s.t. zx=Dzα \min _{z_x, \alpha} \frac{1}{2}\left\|z_y-H z_x\right\|_2^2+\lambda\|\alpha\|_1 \quad \text { s.t. } z_x=D_z \alpha

notation:

min⁡zx,αf(zx)+g(α) s.t. zx=Dzα \min _{z_x, \alpha} f\left(z_x\right)+g(\alpha) \quad \text { s.t. } z_x=D_z \alpha

- f(zx)=12∥zy−Hzx∥22f\left(z_x\right)=\frac{1}{2}\left\|z_y-H z_x\right\|_2^2

- g(α)=λ∥α∥1g(\alpha)=\lambda\|\alpha\|_1.

- zx=Dzαz_x=D_z \alpha is the dictionary on the entire image vector.

We will use the alternating direction method of multipliers (ADMM) as proposed in  [1],  [9],  [10]:

L(zx,α,λ )=f(zx)+g(α)+λ ⊤(zx−Dzα)+μ2∥zx−Dzα∥22. \mathcal{L}\left(z_x, \alpha, \lambda_{\text { }}\right)=f\left(z_x\right)+g(\alpha)+\lambda_{\text { }}^{\top}\left(z_x-D_z \alpha\right)+\frac{\mu}{2}\left\|z_x-D_z \alpha\right\|_2^2 .
u:=λ μ⟺λ =μu. u:=\frac{\lambda_{\text { }}}{\mu} \quad \Longleftrightarrow \quad \lambda_{\text { }}=\mu u .
L(zx,α,λ )=f(zx)+g(α)+(μu)⊤(zx−Dzα)+μ2∥zx−Dzα∥22 \mathcal{L}\left(z_x, \alpha, \lambda_{\text { }}\right)=f\left(z_x\right)+g(\alpha)+(\mu u)^{\top}\left(z_x-D_z \alpha\right)+\frac{\mu}{2}\left\|z_x-D_z \alpha\right\|_2^2

Knowing that:

∥zx−Dzα+u∥22=∥zx−Dzα∥22+2u⊤(zx−Dzα)+∥u∥22. \left\|z_x-D_z \alpha+u\right\|_2^2=\left\|z_x-D_z \alpha\right\|_2^2+2 u^{\top}\left(z_x-D_z \alpha\right)+\|u\|_2^2 .
 Multiply by μ2 : μ2∥zx−Dzα+u∥22=μ2∥zx−Dzα∥22+μu⊤(zx−Dzα)+μ2∥u∥22 \begin{aligned} &\text { Multiply by } \frac{\mu}{2} \text { : }\\ &\frac{\mu}{2}\left\|z_x-D_z \alpha+u\right\|_2^2=\frac{\mu}{2}\left\|z_x-D_z \alpha\right\|_2^2+\mu u^{\top}\left(z_x-D_z \alpha\right)+\frac{\mu}{2}\|u\|_2^2 \end{aligned}
μu⊤(zx−Dzα)+μ2∥zx−Dzα∥22=μ2∥zx−Dzα+u∥22−μ2∥u∥22. \mu u^{\top}\left(z_x-D_z \alpha\right)+\frac{\mu}{2}\left\|z_x-D_z \alpha\right\|_2^2=\frac{\mu}{2}\left\|z_x-D_z \alpha+u\right\|_2^2-\frac{\mu}{2}\|u\|_2^2 .

Then we can express it:

Lμ(zx,α,u)=f(zx)+g(α)+μ2∥zx−Dzα+u∥22−μ2∥u∥22. \mathcal{L}_\mu\left(z_x, \alpha, u\right)=f\left(z_x\right)+g(\alpha)+\frac{\mu}{2}\left\|z_x-D_z \alpha+u\right\|_2^2-\frac{\mu}{2}\|u\|_2^2 .

which is called scaled ADMM form [10]. The alternating solution is as:

zxk+1=arg⁡min⁡zxf(zx)+μ2∥zx−Dzαk+uk∥22αk+1=arg⁡min⁡αg(α)+μ2∥zxk+1−Dzα+uk∥22uk+1=uk+(zxk+1−Dzαk+1) \begin{aligned} & z_x^{k+1}=\arg \min_{z_x} f(z_x)+\frac{\mu}{2}\left\|z_x-D_z \alpha^k+u^k\right\|_2^2 \\ & \alpha^{k+1}=\arg \min _\alpha g(\alpha)+\frac{\mu}{2}\left\|z_x^{k+1}-D_z \alpha+u^k\right\|_2^2 \\ & u^{k+1}=u^k+\left(z_x^{k+1}-D_z \alpha^{k+1}\right) \end{aligned}

Optimizing zxz_x

∇zxf(z)=H†(Hzx−zy)H†(Hzxk+1−zy)+μ(zxk+1−Dzαk+uk)=0⟹(H†H+μI)zxk+1=H†zy+μ(Dzαk−uk) \begin{aligned} & \nabla_{z_x} f(z)=H^{\dagger}\left(H z_x-z_y\right) \\ & \mathrm{} H^{\dagger}\left(H z_x^{k+1}-z_y\right)+\mu\left(z_x^{k+1}-D_z \alpha^k+u^k\right)=0 \\ & \quad \Longrightarrow\left(H^{\dagger} H+\mu I\right) z_x^{k+1}=H^{\dagger} z_y+\mu\left(D_z \alpha^k-u^k\right) \end{aligned}

Here, HH matrix denoting the circular convolution in the vectorized form is a huge matrix with the following form [11]

H=[C0CW−1⋯C1C1C0⋯C2⋮⋮⋱⋮CW−1CW−2⋯C0] H=\left[\begin{array}{cccc} C_0 & C_{W-1} & \cdots & C_1 \\ C_1 & C_0 & \cdots & C_2 \\ \vdots & \vdots & \ddots & \vdots \\ C_{W-1} & C_{W-2} & \cdots & C_0 \end{array}\right]

where

(Cv)i,k=h[(i−k) mod H,v],i,k=0,…,H−1. \left(C_v\right)_{i, k}=h[(i-k) \bmod H, v], \quad i, k=0, \ldots, H-1 .

are the circulant matrix blocks corresponding 1-D convolution.

This matrix is not memory-friendly. We will use its properties to simplify the computation:

We will make use of the Fourier-related diagonalization [11] of the circulant matrices:

H=F−1ΛF H=F^{-1} \Lambda F

where:

- F=FW⊗FHF=F_W \otimes F_H kronecker product which is the separation of 2-D DFT kernel into its axis-components and F−1=F†F^{-1}=F^{\dagger}

- Λ\Lambda is a diagonal matrix with the DFT-2 of the kernel hh :

Λ=diag⁡(H(ωx,ωy)) \Lambda=\operatorname{diag}\left(H\left(\omega_x, \omega_y\right)\right)
H=(FW⊗FH)−1diag⁡(H(ωx,ωy))(FW⊗FH) H=\left(F_W \otimes F_H\right)^{-1} \operatorname{diag}\left(H\left(\omega_x, \omega_y\right)\right)\left(F_W \otimes F_H\right)

Hence, we will derive the update relation using these properties:

H†H=(F†Λ†F)(F†ΛF)=F†Λ†(FF†)ΛF=F†(Λ†Λ)F H^{\dagger} H=\left(F^{\dagger}\Lambda^{\dagger} F\right)\left(F^{\dagger} \Lambda F\right)=F^{\dagger} \Lambda^{\dagger}\left(F F^{\dagger}\right) \Lambda F=F^{\dagger}\left(\Lambda^{\dagger} \Lambda\right) F

Hence,

H†H=F†ΓF,Γ:=diag⁡(∣H(ωk)∣2) H^{\dagger} H=F^{\dagger} \Gamma F, \quad \Gamma:=\operatorname{diag}\left(\left|H\left(\omega_k\right)\right|^2\right)

Knowing that we had this expression:

(H†H+μI)zx=H†zy+μb \left(H^{\dagger} H+\mu I\right) z_x=H^{\dagger} z_y+\mu b

where b:=Dz α−ub:=D_{\text {z }} \alpha-u

b:=Dz α−u=W−1∑ℓ=1LPℓ⊤(Dαℓ)−W−1∑ℓ=1LPℓ⊤uℓ=W−1∑ℓ=1LPℓ⊤(Dαℓ−uℓ).\begin{aligned} b & :=D_{\text {z }} \alpha-u \\ & =W^{-1} \sum_{\ell=1}^L P_{\ell}^{\top}\left(D \alpha_{\ell}\right)-W^{-1} \sum_{\ell=1}^L P_{\ell}^{\top} u_{\ell} \\ & =W^{-1} \sum_{\ell=1}^L P_{\ell}^{\top}\left(D \alpha_{\ell}-u_{\ell}\right) .\end{aligned}

where we define:

uk=W−1∑ℓPℓ⊤uℓk u^k=W^{-1} \sum_{\ell} P_{\ell}^{\top} u_{\ell}^k

(Hence we don’t have the find DzD_{\text{z}})

Equally

F(H†H+μI)zx=F(H†zy+μb). F\left(H^{\dagger} H+\mu I\right) z_x=F\left(H^{\dagger} z_y+\mu b\right) .
F(H†H)zx+μFzx=FH†zy+μFb. F\left(H^{\dagger} H\right) z_x+\mu F z_x=F H^{\dagger} z_y+\mu F b .

Knowing that

F(H†H)zx=F(F†ΓF)zx=(FF†)Γ(Fzx)=Γ(Fzx) F\left(H^{\dagger} H\right) z_x=F\left(F^{\dagger} \Gamma F\right) z_x=\left(F F^{\dagger}\right) \Gamma(F z_x)=\Gamma(F z_x)

Defining,

X:=Fzx,Y:=Fzy,B:=Fb. X:=F z_x, \quad Y:=F z_y, \quad B:=F b .

The LHS of the equation becomes:

ΓX+μX=(Γ+μI)X \Gamma X+\mu X=(\Gamma+\mu I) X

For the RHS, we re-express FH⊤y+μFbF H^{\top} y+\mu F b as follows:

FH†y=F(F†Λ†F)y=(FF†)Λ†(Fy)=Λ†Y. F H^{\dagger} y=F\left(F^{\dagger} \Lambda^{\dagger} F\right) y=\left(F F^{\dagger}\right) \Lambda^{\dagger}(F y)=\Lambda^{\dagger} Y .

Then the equation becomes

(Γ+μI)X=Λ†Y+μB (\Gamma+\mu I) X=\Lambda^{\dagger} Y+\mu B

Due to Kronecker product:

X:=Fzx=(FW⊗FH)x=vec⁡(FFT2(Ximg)) X:=Fz_x=\left(F_W \otimes F_H\right) x=\operatorname{vec}\left(\mathrm{FFT} 2\left(X_{\mathrm{img}}\right)\right)

making this equation element-wise for all ω\omega

(∣H(ω)∣2+μ)X(ω)=H(ω)‾Y(ω)+μB(ω). \left(|H(\omega)|^2+\mu\right) X(\omega)=\overline{H(\omega)} Y(\omega)+\mu B(\omega) .

Then,

Xk+1(ω)=H(ω)‾Y(ω)+μBk(ω)∣H(ω)∣2+μ X^{k+1}(\omega)=\frac{\overline{H(\omega)} Y(\omega)+\mu B^k(\omega)}{|H(\omega)|^2+\mu}

and thus

zxk+1=vec⁡(F−1{Xk+1(ω)}) z_x^{k+1}=\operatorname{vec}\left(\mathcal{F}^{-1}\left\{X^{k+1}(\omega)\right\}\right)

Optimizing α\alpha

We cannot ensure square orthonormal dictionary (D⊤D=ID^{\top} D=I or DD⊤=I DD^{\top}=I) property for online dictionary learning, so we do not have closed form solutions [5].

αk+1=arg⁡min⁡αλ∥α∥1+μ2∥zxk+1−Dzα+uk∥22\alpha^{k+1}=\arg \min _\alpha \lambda\|\alpha\|_1+\frac{\mu}{2}\left\|z_x^{k+1}-D_z \alpha+u^k\right\|_2^2 is solved by ISTA [12], [13] as follows:

1. Gradient step

Define: mk=zxk+1+ukm^k=z_x^{k+1}+u^k

α~t+1k=αtk−1LμD⊤(Dαtk−mk). \tilde{\alpha}^{k}_{t+1}=\alpha^{k}_{t}-\frac{1}{L} \mu D^{\top}\left(D \alpha^{k}_{t}-m^k\right) .

2. Soft-threshold step

αt+1k=Sλ/L(α~t+1k). \alpha^{k}_{t+1}=S_{\lambda / L}\left(\tilde{\alpha}^{k}_{t+1}\right) .

where:

Sτ(v)=sign⁡(v)max⁡(∣v∣−τ,0). \mathcal{S}_\tau(v)=\operatorname{sign}(v) \max (|v|-\tau, 0) .

after a predetermined number of iterations:

αk+1=αt+1k. \alpha^{k+1}=\alpha^{k}_{t+1}.

It seems that we still need large Dtotal D_{\text {total }} but in patch version we optimize the total α\alpha by optimizing individual:

αtotal =[α1α2⋮αL]\alpha_{\text {total }}=\left[\begin{array}{c}\alpha_1 \\ \alpha_2 \\ \vdots \\ \alpha_L\end{array}\right]
αℓk+1=arg⁡min⁡αλ∥α∥1+μ2∥Pℓzxk+1−Dα+uℓk∥22. \alpha_{\ell}^{k+1}=\arg \min _\alpha \lambda\|\alpha\|_1+\frac{\mu}{2}\left\|P_{\ell} z_x^{k+1}-D \alpha+u_{\ell}^k\right\|_2^2 .

where

pℓk+1=Pℓzxk+1 p_{\ell}^{k+1}=P_{\ell} z_x^{k+1}

Defining: mℓk:=pℓk+1+uℓkm_{\ell}^k:=p_{\ell}^{k+1}+u_{\ell}^k

and ISTA steps become:

α~ℓ(t+1)=αℓ(t)−μLD⊤(Dαℓ(t)−mℓk) \tilde{\alpha}_{\ell}^{(t+1)}=\alpha_{\ell}^{(t)}-\frac{\mu}{L} D^{\top}\left(D \alpha_{\ell}^{(t)}-m_{\ell}^k\right)

and

αℓ(t+1)=SλL(α~ℓ(t+1)) \alpha_{\ell}^{(t+1)}=S_{\frac{\lambda}{L}}\left(\tilde{\alpha}_{\ell}^{(t+1)}\right)

Optimizing uu

We already know that (by the derived algorithm of ADMM, [9] [10])

uk+1=uk+(zxk+1−Dzαk+1) u^{k+1}=u^k+\left(z_x^{k+1}-D_{z} \alpha^{k+1}\right)

Previously we have defined:

uℓk:=Pℓuk,uℓk+1:=Pℓuk+1. u_{\ell}^k:=P_{\ell} u^k, \quad u_{\ell}^{k+1}:=P_{\ell} u^{k+1} .

Knowing that:

Dz=[P1⊤DP2⊤D⋯PL⊤D]∈RM×LK D_{z}=\left[\begin{array}{llll} P_1^{\top} D & P_2^{\top} D & \cdots & P_L^{\top} D \end{array}\right] \in \mathbb{R}^{M \times L K}
Dzαk+1=∑ℓ=1LPℓ⊤Dαℓk+1 D_{z} \alpha^{k+1}=\sum_{\ell=1}^L P_{\ell}^{\top} D \alpha_{\ell}^{k+1}

Multiplying the expression by PℓP_\ell

Pℓuk+1=Pℓuk+(Pℓzxk+1−PℓDzαk+1) P_{\ell} u^{k+1}=P_{\ell} u^k+\left(P_{\ell} z_x^{k+1}-P_{\ell} D_{z}\alpha^{k+1}\right)
uℓk+1=uℓk+(Pℓzxk+1−PℓDzαk+1) u_{\ell}^{k+1}=u_{\ell}^k+\left(P_{\ell} z_x^{k+1}-P_{\ell} D_{z} \alpha^{k+1}\right)

Remark:

PℓDzαk+1=PℓW−1∑j=1LPj⊤Dαjk+1=PℓW−1∑j=1LPj⊤Dαjk+1 P_{\ell} D_{z}\alpha^{k+1}=P_{\ell} W^{-1}\sum_{j=1}^L P_j^{\top} D \alpha_j^{k+1}=P_{\ell} W^{-1}\sum_{j=1}^L P_j^{\top} D \alpha_j^{k+1}

Then the generic solution is:

uℓk+1=uℓk+(Pℓzxk+1−Pℓzdictk+1) u_{\ell}^{k+1}=u_{\ell}^k+\left(P_{\ell} z_x^{k+1}-P_{\ell} z_{\mathrm{dict}}^{k+1}\right)

where

zdict k+1=W−1∑j=1LPj⊤Dαjk+1. z_{\text {dict }}^{k+1}=W^{-1} \sum_{j=1}^L P_j^{\top} D \alpha_j^{k+1} .

We can assume patches to be non-overlapping for ease of computation. Knowing that PℓPj⊤=δl,jInpP_{\ell} P_j^{\top}=\delta_{l,j}I_{n_p} for non-overlapping patches:

PℓDzαk+1=Dαℓk+1 P_{\ell} D_{z}\alpha^{k+1}=D \alpha_{\ell}^{k+1}

If we do it for all PℓP_\ell , this global update is equivalent to so-called patch-wise update as

uℓk+1=uℓk+(Pℓzxk+1−Dαℓk+1) u_{\ell}^{k+1}=u_{\ell}^k+\left(P_{\ell} z_x^{k+1}-D \alpha_{\ell}^{k+1}\right)

3.4Overall Algorithm Structure

The entire algorithm of our pipeline is presented in 3 major sections as seen below:

Algorithm 8: Kernel Estimation: Posterior Initialization + Cho–Lee Multi-Scale Refinement
1:[!h]
Input: Training pairs {(xmtr,ymtr)}m=1M\{(x^{tr}_m,y^{tr}_m)\}_{m=1}^M; patch size pp; kernel sizes {ks}\{k_s\}; ridge λ\lambda; prior scale βtr\beta_{tr}; feature scale γ\gamma; KDE bandwidth constant AA;
Test blurry image y\*y^\*; pyramid scales S={32,64,128,256}\mathcal{S}=\{32,64,128,256\}; iterations per scale NsN_s;
Cho–Lee parameters (σs,σr,Δt)(\sigma_s,\sigma_r,\Delta t); weights (w0,w1,w2)(w_0,w_1,w_2); kernel reg. β\beta; latent reg. α\alpha.
Output: Refined blur kernel h^\hat{h} (and optionally latent X^\hat{X} at full scale).
2:Stage 1A: build kernel library from training patches
3:Extract overlapping patches {(xm,j,ym,j)}\{(x_{m,j},y_{m,j})\} from {(xmtr,ymtr)}\{(x^{tr}_m,y^{tr}_m)\}
4:for each (xm,j,ym,j)(x_{m,j},y_{m,j}) do
5:Compute FFTs Xm,j(ω)=F{xm,j}X_{m,j}(\omega)=\mathcal{F}\{x_{m,j}\}, Ym,j(ω)=F{ym,j}Y_{m,j}(\omega)=\mathcal{F}\{y_{m,j}\}
6:Compute per-frequency kernel (ridge inversion): Hm,j(ω)←Ym,j(ω) Xm,j∗(ω)∣Xm,j(ω)∣2+λH_{m,j}(\omega) \leftarrow \dfrac{Y_{m,j}(\omega)\,X_{m,j}^\ast(\omega)}{|X_{m,j}(\omega)|^2+\lambda}
7:Inverse FFT ⇒hm,j\Rightarrow h_{m,j}; center & crop to k×kk\times k; project to PSF: hm,j←max⁡(hm,j,0)h_{m,j}\leftarrow \max(h_{m,j},0), hm,j←hm,j/∑hm,jh_{m,j}\leftarrow h_{m,j}/\sum h_{m,j}
8:Compute reconstruction loss ℓm,j\ell_{m,j} and blur feature vector ϕm,j∈R4\phi_{m,j}\in\mathbb{R}^4
9:Store {hi,ℓi,ϕi}i=1N\{h_i,\ell_i,\phi_i\}_{i=1}^N
10:Stage 1B: prior weights and KDE bandwidth
11:Shift losses ℓ~i=ℓi−min⁡jℓj\tilde{\ell}_i=\ell_i-\min_j \ell_j
12:Set wiprior←exp⁡(−βtrℓ~i)∑jexp⁡(−βtrℓ~j)w^{prior}_i \leftarrow \dfrac{\exp(-\beta_{tr}\tilde{\ell}_i)}{\sum_j \exp(-\beta_{tr}\tilde{\ell}_j)}
13:Set nh=k2n_h=k^2 and hopt←A N−1/(nh+4)h_{opt}\leftarrow A\,N^{-1/(n_h+4)}
14:Stage 2: posterior update + jittered sampling on test patches
15:Extract non-overlapping test patches {y\*(k)}k=1K\{y^\*(k)\}_{k=1}^K and features ϕk\*\phi^\*_k
16:for k=1k=1 to KK do
17:Compute distances di,k2=∥ϕi−ϕk\*∥22d^2_{i,k}=\|\phi_i-\phi^\*_k\|_2^2
18:Posterior weights: wi,kpost←wiprior exp⁡(−γdi,k2)∑jwjprior exp⁡(−γdj,k2)w^{post}_{i,k} \leftarrow \dfrac{w^{prior}_i\,\exp(-\gamma d^2_{i,k})}{\sum_j w^{prior}_j\,\exp(-\gamma d^2_{j,k})}
19:Weighted mean and covariance: μk←∑iwi,kposthi\mu_k \leftarrow \sum_i w^{post}_{i,k} h_i, Sk←∑iwi,kpost(hi−μk)(hi−μk)⊤+εIS_k \leftarrow \sum_i w^{post}_{i,k}(h_i-\mu_k)(h_i-\mu_k)^\top+\varepsilon I
20:Sample ancestor ak∼Cat(w⋅,kpost)a_k\sim \text{Cat}(w^{post}_{\cdot,k}), draw ϵk∼N(0,I)\epsilon_k\sim\mathcal{N}(0,I)
21:Set h~k←hak+hopt Dkϵk\tilde{h}_k \leftarrow h_{a_k} + h_{opt}\,D_k\epsilon_k where Sk=DkDk⊤S_k=D_kD_k^\top
22:Reshape to k×kk\times k, project to PSF constraints
23:Aggregate initial kernel: h^(0)←1K∑k=1Kh~k\hat{h}^{(0)} \leftarrow \dfrac{1}{K}\sum_{k=1}^K \tilde{h}_k;
24:Project h^(0)\hat{h}^{(0)} to PSF constraints
25:Stage 3: Cho–Lee coarse-to-fine refinement
26:Build pyramid Y(s)=Resize(y\*,s×s)Y^{(s)}=\texttt{Resize}(y^\*,s\times s) for s∈Ss\in\mathcal{S}
27:Initialize at coarsest scale s0=32s_0=32: X(s0)←Y(s0)X^{(s_0)}\leftarrow Y^{(s_0)}, h(s0)←Resize(h^(0),ks0×ks0)h^{(s_0)}\leftarrow \texttt{Resize}(\hat{h}^{(0)},k_{s_0}\times k_{s_0})
28:for each s∈Ss \in \mathcal{S} do
29:if s≠s0s\neq s_0 then
30:X(s)←Upsample(X(prev))X^{(s)} \leftarrow \texttt{Upsample}(X^{(prev)}), h(s)←Resize(h(prev),ks×ks)h^{(s)} \leftarrow \texttt{Resize}(h^{(prev)},k_s\times k_s)
31:for t=1t=1 to NsN_s do
32:Prediction (Cho–Lee):
33:Xb←Bilateral(X(s);σs,σr)X_b \leftarrow \texttt{Bilateral}(X^{(s)};\sigma_s,\sigma_r)
34:Xs←Shock(Xb;Δt)X_s \leftarrow \texttt{Shock}(X_b;\Delta t)
35:Compute gradients (gx,gy)(g_x,g_y), magnitude g=gx2+gy2g=\sqrt{g_x^2+g_y^2}
36:Choose threshold τ\tau so a fixed fraction survives; mask M={(i,j):g(i,j)≥τ}\mathcal{M}=\{(i,j):g(i,j)\ge \tau\}
37:Px←gx⋅1MP_x \leftarrow g_x\cdot \mathbf{1}_{\mathcal{M}}, Py←gy⋅1MP_y \leftarrow g_y\cdot \mathbf{1}_{\mathcal{M}}
38:Kernel update (weighted LS in FFT):
39:Form derivative channels m∈{x,y,xx,yy,xy}m\in\{x,y,xx,yy,xy\} with (Pm,Ym)(P_m,Y_m) and weights wmw_m
40:Update H^(ω)←∑mwm P^m∗(ω)Y^m(ω)∑mwm∣P^m(ω)∣2+β\widehat{H}(\omega)\leftarrow \dfrac{\sum_m w_m\,\widehat{P}_m^\ast(\omega)\widehat{Y}_m(\omega)}{\sum_m w_m|\widehat{P}_m(\omega)|^2+\beta}
41:Inverse FFT ⇒h(s)\Rightarrow h^{(s)}; center/crop; threshold small values; project to PSF
42:Latent update (weighted LS in FFT):
43:Compute M1(ω)=∣Dx∣2+∣Dy∣2M_1(\omega)=|D_x|^2+|D_y|^2, M2(ω)=∣Dxx∣2+∣Dyy∣2+∣Dxy∣2M_2(\omega)=|D_{xx}|^2+|D_{yy}|^2+|D_{xy}|^2
44:W(ω)←w0+w1M1(ω)+w2M2(ω)W(\omega)\leftarrow w_0+w_1M_1(\omega)+w_2M_2(\omega)
45:Update X^(ω)←H^∗(ω) Y^(s)(ω) W(ω)∣H^(ω)∣2W(ω)+αM1(ω)+ϵ\widehat{X}(\omega)\leftarrow \dfrac{\widehat{H}^\ast(\omega)\,\widehat{Y}^{(s)}(\omega)\,W(\omega)} {|\widehat{H}(\omega)|^2W(\omega)+\alpha M_1(\omega)+\epsilon}
46:Inverse FFT ⇒X(s)\Rightarrow X^{(s)}
47:prev←sprev \leftarrow s
48:return h^←h(256)\hat{h}\leftarrow h^{(256)} (and optionally X^←X(256)\hat{X}\leftarrow X^{(256)})
Algorithm 9: Dictionary Learning: Online Patch Dictionary (Mairal et al.)
1:[!h]
Input: Sharp training images {xmtr}m=1M\{x^{tr}_m\}_{m=1}^M; patch operator {Pℓ}\{P_\ell\} with patch size p×pp\times p; dictionary size KK; sparsity weight λ\lambda; iterations TT; initial dictionary D0∈Rp2×KD_0\in\mathbb{R}^{p^2\times K}.
Output: Learned patch dictionary D∈Rp2×KD\in\mathbb{R}^{p^2\times K}.
2:Initialize D←D0D \leftarrow D_0, A←0∈RK×KA\leftarrow 0\in\mathbb{R}^{K\times K}, B←0∈Rp2×KB\leftarrow 0\in\mathbb{R}^{p^2\times K}
3:for t=1t=1 to TT do
4:Sample a sharp training patch xt∈Rp2x_t \in \mathbb{R}^{p^2} from the pool of {Pℓxmtr}\{P_\ell x^{tr}_m\}
5:Sparse coding (LASSO): αt←arg⁡min⁡α∈RK12∥xt−Dα∥22+λ∥α∥1\alpha_t \leftarrow \arg\min_{\alpha\in\mathbb{R}^K} \frac{1}{2}\|x_t-D\alpha\|_2^2+\lambda\|\alpha\|_1
6:Update sufficient statistics: A←A+αtαt⊤A \leftarrow A + \alpha_t\alpha_t^\top, B←B+xtαt⊤B \leftarrow B + x_t\alpha_t^\top
7:Dictionary update (column-wise, normalized):
8:for j=1j=1 to KK do
9:uj←1A[j,j](bj−Daj)+dju_j \leftarrow \frac{1}{A[j,j]}\big(b_j - D a_j\big) + d_j
10:dj←ujmax⁡(∥uj∥2,1)d_j \leftarrow \frac{u_j}{\max(\|u_j\|_2,1)}
11:return DD
Algorithm 10: Inference: Deblur via Scaled ADMM with Fixed Kernel hh and Learned Dictionary DD
1:[!h]
Input: Blurry image yy (vectorized zy∈RMz_y\in\mathbb{R}^M); fixed kernel hh with FFT H(ω)H(\omega); learned dictionary D∈Rp2×KD\in\mathbb{R}^{p^2\times K}; patch operators {Pℓ}ℓ=1L\{P_\ell\}_{\ell=1}^L;
ADMM penalty μ\mu (optionally scheduled); sparsity weight λ\lambda; ISTA steps TISTAT_{\text{ISTA}} and step size LL; max ADMM iters Kmax⁡K_{\max}.
Output: Restored clean image zx⋆z_x^\star (and patch codes {αℓ}\{\alpha_\ell\}).
2:Initialize zx0←zyz_x^{0}\leftarrow z_y, αℓ0←0\alpha_\ell^{0}\leftarrow 0, uℓ0←0u_\ell^{0}\leftarrow 0 for all ℓ\ell
3:for k=0k=0 to Kmax⁡−1K_{\max}-1 do
4:(1) zxz_x-update (FFT diagonalization of circular convolution)
5:Form patch-fusion term (as in report): bk←W−1∑ℓ=1LPℓ⊤(Dαℓk−uℓk)b^k \leftarrow W^{-1}\sum_{\ell=1}^{L} P_\ell^\top\big(D\alpha_\ell^{k}-u_\ell^{k}\big) where W=∑ℓ=1LPℓ⊤PℓW=\sum_{\ell=1}^{L}P_\ell^\top P_\ell
6:Compute FFTs: Y(ω)←F{zy}Y(\omega)\leftarrow \mathcal{F}\{z_y\}, Bk(ω)←F{bk}B^k(\omega)\leftarrow \mathcal{F}\{b^k\}
7:Element-wise update for all frequencies ω\omega:
Xk+1(ω)←H∗(ω)Y(ω)+μ Bk(ω)∣H(ω)∣2+μ X^{k+1}(\omega)\leftarrow \frac{H^\ast(\omega)Y(\omega)+\mu\,B^k(\omega)}{|H(\omega)|^2+\mu}
8:Inverse FFT: zxk+1←F−1{Xk+1(ω)}z_x^{k+1}\leftarrow \mathcal{F}^{-1}\{X^{k+1}(\omega)\}
9:(2) α\alpha-update (patch-wise ISTA / soft-threshold)
10:for each patch ℓ=1,…,L\ell=1,\dots,L do
11:pℓk+1←Pℓzxk+1p_\ell^{k+1}\leftarrow P_\ell z_x^{k+1}, mℓk←pℓk+1+uℓkm_\ell^k\leftarrow p_\ell^{k+1}+u_\ell^k
12:αℓ(0)←αℓk\alpha_\ell^{(0)}\leftarrow \alpha_\ell^{k}
13:for t=0t=0 to TISTA−1T_{\text{ISTA}}-1 do
14:α~ℓ(t+1)←αℓ(t)−μLD⊤(Dαℓ(t)−mℓk)\tilde{\alpha}_\ell^{(t+1)}\leftarrow \alpha_\ell^{(t)}-\frac{\mu}{L}D^\top\big(D\alpha_\ell^{(t)}-m_\ell^k\big)
15:αℓ(t+1)←Sλ/L ⁣(α~ℓ(t+1))\alpha_\ell^{(t+1)}\leftarrow \mathcal{S}_{\lambda/L}\!\big(\tilde{\alpha}_\ell^{(t+1)}\big)
16:αℓk+1←αℓ(TISTA)\alpha_\ell^{k+1}\leftarrow \alpha_\ell^{(T_{\text{ISTA}})}
17:(3) Dual update (scaled form)
18:for each patch ℓ=1,…,L\ell=1,\dots,L do
19:uℓk+1←uℓk+(Pℓzxk+1−Dαℓk+1)u_\ell^{k+1}\leftarrow u_\ell^{k}+\big(P_\ell z_x^{k+1}-D\alpha_\ell^{k+1}\big)
20:Stopping (optional):
21:stop if primal/dual residuals satisfy tolerances
22:return zx⋆←zxk+1z_x^\star \leftarrow z_x^{k+1}

4Results

4.1Kernel Estimation

End-to-end pipeline for the experiment can be described as follows:

Based on the samples from the kernels we build the prior and we apply the posterior weight update corresponding to posterior distribution. The samples from it will initialize the iterative algorithm of Cho-Lee, which runs for 12 iterations.

The results are depicted in the Fig 1, which shows that the end result captures the motion.

h init 5

(a) Initial estimation sample

kernel final 5

(b) 5x5 estimation

kernel final 7

(c) 7x7 estimation

kernel final 9

(d) 9x9 estimation

kernel final 11

(e) 11x11 estimation
Figure 1: Evolution of the estimated kernels throughout Cho and Lee of the image shown in Fig 3.

4.2Dictionary Reconstruction and the Results of the ADMM

We use the predicted H and fix it throughout ADMM as a design choice. For the iterative steps of ADMM, initially we start with large dictionary constraint hyperparameter μ\mu so that the estimated clear image update depends heavily on the dictionary reconstruction ∥zx−Dzα∥22\left\|z_x-D_z \alpha\right\|_2^2, which promotes the iteration outcomes to lie in the clear image space (i.e which overall can be interpreted as avoidance of the trivial blurred prediction for the clear image, encouraged by the separate hh and xx optimization and dictionary reconstruction). The outcomes of the ADMM steps indicate the the predicted image gets cleared as steps increased as can be seen in Fig 3 and 4. As can be seen on the Fig 2, dictionary can reconstruct the clear image.

input blur 1

(a) Input blurred image

dict reconstruction 19

(b) Dictionary-based reconstruction

final result 1

(c) Final deblurred result
Figure 2: Deblurring using dictionary-based reconstruction on the building image.

input blur

(a) Blurred Input

admm 03

(b) ADMM iteration 3

admm 10

(c) ADMM iteration 10

final result

(d) Final ADMM result
Figure 3: Evolution of the ADMM reconstruction across selected iterations and the final result.

input blur

(a) Input blurred image

admm 03

(b) ADMM iteration 3

admm 10

(c) ADMM iteration 10

final result

(d) Final ADMM reconstruction
Figure 4: ADMM deblurring process showing the input blurred image, intermediate reconstructions, and the final result.

We claim that the sharpness of the image can be measured by high frequency components and graident based metrics (such as Tenengrad =∑x,y(Gx2+Gy2)=\sum_{x, y}\left(G_x^2+G_y^2\right)) and the metrics are shown in the Tables 1 and 2

Table 1: Sharpness-related metrics across ADMM iterations and final output (of Fig 4).
idxlabelfilegrad_powertenengradhf_ratio
0blurinput_blur.png5.944804e-045.944804e-040.000861
1admm_00admm_00.png2.491733e-042.491733e-040.000255
2admm_01admm_01.png5.062831e-045.062831e-040.000146
3admm_02admm_02.png7.974522e-047.974522e-040.000214
4admm_03admm_03.png1.051128e-031.051128e-030.000313
5admm_04admm_04.png1.275241e-031.275241e-030.000442
6admm_05admm_05.png1.485745e-031.485745e-030.000598
7admm_06admm_06.png1.690356e-031.690356e-030.000786
8admm_07admm_07.png1.895307e-031.895307e-030.001009
9admm_08admm_08.png2.105915e-032.105915e-030.001276
10admm_09admm_09.png2.326757e-032.326757e-030.001605
11admm_10admm_10.png2.560284e-032.560284e-030.002021
12admm_11admm_11.png2.805360e-032.805360e-030.002558
13admm_12admm_12.png3.061679e-033.061679e-030.003263
14admm_13admm_13.png3.325560e-033.325560e-030.004183
15admm_14admm_14.png3.599105e-033.599105e-030.005386
16admm_15admm_15.png3.871754e-033.871754e-030.006822
17admm_16admm_17.png4.317180e-034.317180e-030.009264
18admm_17admm_18.png4.530648e-034.530648e-030.010648
19admm_18admm_19.png4.742994e-034.742994e-030.012195
20finalfinal_result.png4.742994e-034.742994e-030.012195
Table 2: Sharpness metrics computed over ADMM iterations and the final reconstructio (of Fig 3) .
idxlabelfilegrad_powertenengradhf_ratio
0blurinput_blur.png5.694281e-045.694281e-040.000473
1admm_00admm_00.png3.109234e-043.109234e-040.000203
2admm_01admm_01.png6.035091e-046.035091e-040.000092
3admm_02admm_02.png9.359412e-049.359412e-040.000138
4admm_03admm_03.png1.230954e-031.230954e-030.000242
5admm_04admm_04.png1.482488e-031.482488e-030.000396
6admm_05admm_05.png1.683529e-031.683529e-030.000573
7admm_06admm_06.png1.862015e-031.862015e-030.000800
8admm_07admm_07.png2.027196e-032.027196e-030.001072
9admm_08admm_08.png2.186032e-032.186032e-030.001383
10admm_09admm_09.png2.339068e-032.339068e-030.001728
11admm_10admm_10.png2.481365e-032.481365e-030.002090
12admm_11admm_11.png2.609914e-032.609914e-030.002448
13admm_12admm_12.png2.723556e-032.723556e-030.002796
14admm_13admm_13.png2.822662e-032.822662e-030.003120
15admm_14admm_14.png2.908497e-032.908497e-030.003420
16admm_15admm_15.png2.981219e-032.981219e-030.003691
17admm_16admm_16.png3.044691e-033.044691e-030.003947
18admm_17admm_17.png3.103093e-033.103093e-030.004201
19admm_18admm_18.png3.157139e-033.157139e-030.004460
20admm_19admm_19.png3.209012e-033.209012e-030.004732
21finalfinal_result.png4.742994e-034.742994e-030.012195

Moreover, here is the radial FFT power plots to explicitly see how high frequencies are reintroduced after deblurring as can be seen in the Fig 5.

radial fft overlay blur admm01 admm05 final

(a) Cup

radial fft overlay blur admm01 admm05 final

(b) Building
Figure 5: Radial FFT comparison between the Cup and Building Images.

4.3Wiener vs ADMM

We then compared visually the outputs of the baseline Wiener filter (using our estimated kernel to obtain the blur image.

As can be seen in the Fig 6 , the Wiener filter performs worse when it comes to especially

input blur

(a) Input blurred image

deblur wiener

(b) Wiener deblurring result

final result

(c) ADMM deblurring result
Figure 6: Comparison of input blur, Wiener deblurring, and ADMM-based deblurring.

5Discussion

Our pipeline begins with kernel estimation, which is one of the most crucial part of the blind image de-blurring, since throughout our experiments, we have observed that the correct estimation of kernel affects the rest of the algorithms dramatically. In our method, we initialize the kernel in 5*5 dimensions, which appears to be engulfed by the motion blur (many white points), which can be avoided with larger size initialization. Nonetheless, Cho and Lee based approach fine tunes the kernel and clearly shows the alignment with the motion gradually.

Based on our sharpness evaluation metrics, we clearly see that the ADMM steps gradually increase sharpness as verified by the visual outputs too. Our learned patch-based dictionary shows its reconstruction capability. Moreover, experimented Wiener filter can under-perform our algorithm.

However, our algorithm ADMM is based on FFT domain to facilitate the updates, which implicitly assumes circular convolution model, which gives us wrap-around stripes at the edges. Additionally, adjusting the sweet-spot of the hyper-parameters is a lengthy process since our algorithm is slower due to many sub-steps such as dictionary learning, ISTA iterations inside the ADMM. Moreover, the performance depends highly on the dataset, from which we obtain the initialization of the kernel estimation and we learn the dictionary.

6Conclusion

In this project, we aimed to address the deblurring of an image, by first estimating the blur kernel via posterior sample initialization and multi-scale fine tuning, online patch dictionary learning for the sparse representation, indicating the clear image subspace and patch-wise ADMM iterative algorithm to gradually obtain the clear image. Hence, the method remains scalable to large datasets and high-resolution images. However, FFT wraps-around should be suppressed and the further fine tuning of various hyper-parameters to improve the performance of dictionary learning, ADMM and inside ISTA steps should be performed. This requires a lengthy careful fine tuning due to having many hyperparameter and longer ADMM iteration duration (when compared to classical Wiener). Initial kernel estimation and dictionary learning heavily rely on the utilized dataset. Thus, any non-ideal and incompatible dataset can give misleading results.

Although the entire algorithm requires to be further fine-tuned, the idea of learning a clear image subspace via Dictionary using as much dataset as we want and eventually turning our de-blurring task to an optimization problem with patch-wise feasible implementation builds the foundation of our project. Additionally, optimization based solution is about image restoration problem, agnostic to specific domains, this gives a solution for the cases outside the common de-blurring, as long as the dataset is available.

7Appendix

Code Repository

The codes and the full resolution file of this report are available at the following Google Drive folder:

Files included:

  • Original Report File
  • evaluate-metrics.py -> Performance metric evaluation
  • Motion_deblurring_main_code.py -> Main algorithm
  • wiener-test.py -> Wiener filtering using the estimated kernel for comparison purposes

References

  1. [1] Wang, R., Tao, D. (2014). Recent progress in image deblurring. arXiv preprint arXiv:1409.6838.
  2. [2] Zhang, K., Ren, W., Luo, W., Lai, W. S., Stenger, B., Yang, M. H., Li, H. (2022). Deep image deblurring: A survey. International Journal of Computer Vision, 130(9), 2103-2130.
  3. [3] Levin, A., Weiss, Y., Durand, F., Freeman, W. T. (2009, June). Understanding and evaluating blind deconvolution algorithms. In 2009 IEEE conference on computer vision and pattern recognition (pp. 1964-1971). IEEE.
  4. [4] Cho, S., Lee, S. (2009). Fast motion deblurring. In ACM SIGGRAPH Asia 2009 papers (pp. 1-8).
  5. [5] Mairal, J., Bach, F., Ponce, J., Sapiro, G. (2010). Online learning for matrix factorization and sparse coding. Journal of Machine Learning Research, 11(1).
  6. [6] Aleksey Alekseev (Kwentar). blur_dataset [Data set]. GitHub. Available at: https://github.com/Kwentar/blur_dataset
  7. [7] Bhalley, R. (n.d.). GoPro Deblur dataset [Data set]. Kaggle. https://www.kaggle.com/datasets/rahulbhalley/gopro-deblur
  8. [8] Shan, Q., Jia, J., Agarwala, A. (2008). High-quality motion deblurring from a single image. Acm transactions on graphics (tog), 27(3), 1-10
  9. [9] Afonso, M. V., Bioucas-Dias, J. M., Figueiredo, M. A. (2010). Fast image recovery using variable splitting and constrained optimization. IEEE transactions on image processing, 19(9), 2345-2356.
  10. [10] S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein, “Distributed Optimization and Statistical Learning via the Alternating Direction Method of Multipliers,” Foundations and Trends in Machine Learning, vol. 3, no. 1, pp. 1–122, 2011.
  11. [11] Gray, R. M. (2006). Toeplitz and circulant matrices: A review. Foundations and Trends in Communications and Information Theory, 2(3), 155–239.
  12. [12] Beck, A., Teboulle, M. (2009). A fast iterative shrinkage-thresholding algorithm for linear inverse problems. SIAM journal on imaging sciences, 2(1), 183-202.
  13. [13] Daubechies, I., Defrise, M., De Mol, C. (2004). An iterative thresholding algorithm for linear inverse problems with a sparsity constraint. Communications on Pure and Applied Mathematics: A Journal Issued by the Courant Institute of Mathematical Sciences, 57(11), 1413-1457.