Fast and Interpretable Nonlocal Neural Networks for Image Denoising via
  Group-Sparse Convolutional Dictionary Learning
Nonlocal self-similarity within natural images has become an increasingly
popular prior in deep-learning models. Despite their successful image
restoration performance, such models remain largely uninterpretable due to
their black-box construction. Our previous studies have shown that
interpretable construction of a fully convolutional denoiser (CDLNet), with
performance on par with state-of-the-art black-box counterparts, is achievable
by unrolling a dictionary learning algorithm. In this manuscript, we seek an
interpretable construction of a convolutional network with a nonlocal
self-similarity prior that performs on par with black-box nonlocal models. We
show that such an architecture can be effectively achieved by upgrading the
$\ell 1$ sparsity prior of CDLNet to a weighted group-sparsity prior. From this
formulation, we propose a novel sliding-window nonlocal operation, enabled by
sparse array arithmetic. In addition to competitive performance with black-box
nonlocal DNNs, we demonstrate the proposed sliding-window sparse attention
enables inference speeds greater than an order of magnitude faster than its
competitors.
Nikola Janjušević, Amirhossein Khalilian-Gourtani, Adeen Flinker, Yao Wang
# Fast and Interpretable Nonlocal Neural Networks

###### Abstract

Nonlocal self-similarity within natural images has become an increasingly popular prior in deep-learning models. Despite their successful image restoration performance, such models remain largely uninterpretable due to their black-box construction. Our previous studies have shown that interpretable construction of a fully convolutional denoiser (CDLNet), with performance on par with state-of-the-art black-box counterparts, is achievable by unrolling a dictionary learning algorithm. In this manuscript, we seek an interpretable construction of a convolutional network with a nonlocal self-similarity prior that performs on par with black-box nonlocal models. We show that such an architecture can be effectively achieved by upgrading the \(\ell_{1}\) sparsity prior of CDLNet to a weighted group-sparsity prior. From this formulation, we propose a novel sliding-window nonlocal operation, enabled by sparse array arithmetic. In addition to competitive performance with black-box nonlocal DNNs, we demonstrate the proposed sliding-window sparse attention enables inference speeds greater than an order of magnitude faster than its competitors.

 Deep-learning, interpretable neural network, nonlocal self-similarity, group-sparsity, unrolled network, convolutional dictionary learning, image denoising

## I Background and Introduction

Nonlocal self-similarity (NLSS) of natural images has proven to be a powerful signal prior for classical and deep-learning based image restoration. However, state-of-the-art NLSS deep-learning methods are widely constructed as black-boxes, often rendering their analysis and improvement beholden to trial and error. Additionally, current implementations of the NLSS prior in deep-learning separately process overlapping image windows, falsely neglecting the dependency between these overlaps. Here, we address these two shortcomings of nonlocal deep neural networks (DNNs) from the perspective of interpretable architecture design and sparse array arithmetic.

A growing literature of DNNs, derived as direct parameterizations of classical image restoration algorithms, perform on par with state-of-the-art black-box fully convolutional neural networks, without employing common deep-learning tricks (such as batch-normalization, residual learning, and feature domain processing). This interpretable construction has been shown to be instrumental in obtaining parameter and dataset efficiency [1, 2, 3, 4, 5]. Our previous work, CDLNet [1], introduced a unique interpretable construction, based on convolutional dictionary learning, and achieved novel robustness to mismatches in observed noise-level during training and inference. By incorporating the NLSS prior into CDLNet, we demonstrate the first instance of an interpretable network bridging the performance gap to state-of-the-art nonlocal black-box methods for image denoising.

Nonlocal layers attempt to model long-range image dependencies by computing pixel-wise self-similarity metrics. To tame the quadratic computational complexity of this operation, image-restoration DNNs generally rely on computing an overlapping window NLSS (OW-NLSS) of the input, by which overlapping image windows are processed independently by the layer/network and subsequently averaged on overlapping regions to produce the final output [2, 6]. Naturally, ON-NLSS incurs a runtime penalty by redundant overlap processing and a restoration penalty due to the disregard for the correlation among these overlapping regions. In this work, we propose a novel sliding-window NLSS (SW-NLSS) operation that addresses these shortcomings.

Previous work used a patch-based group-sparsity prior and OW-NLSS in an interpretably constructed DNN [2]. However, this approach did not achieve competitive performance with black-box NLSS DNNs. In contrast, we propose to enforce pixel-wise group-sparsity of a latent representation with a dimensionality reduction on the number of channels. We also propose the novel SW-NLSS operation, and achieve denoising performance on par with the state-of-the-art methods at a fraction of the inference time.

We highlight the following contributions:

* a novel and efficient sliding-window nonlocal self-similarity operation which addresses the modeling and computational shortcomings of overlapping-window NLSS.
* a novel thresholding operation, inspired by a group-sparsity prior, which utilizes a reduced channel dimension of the latent space to achieve state-of-the-art inference speeds.
* an interpretable nonlocal CNN with competitive natural image denoising performance to state-of-the-art black-box models.
* a fast and open-source implementation1 in the Julia programming language [7]. Footnote 1: [https://github.com/nikopj/GroupCDL-TIP](https://github.com/nikopj/GroupCDL-TIP).
In Section II, we introduce the mathematics and notation behind classical convolutional dictionary learning and group-sparse representation. We also provide context for related black-box and interpretable deep-learning methods. In Section III, we introduce our sliding-window nonlocal CNN derived from group-sparse convolutional dictionary learning, dubbed GroupCDL. In Section IV, we show experimental results that compare GroupCDL to state-of-the-art deep learning methods.

## II Preliminaries and Related Work

### _Dictionary Learning and Group-Sparse Representation_

We consider the observation model of additive white Gaussian-noise (AWGN),

\[\mathbf{y}=\mathbf{x}+\mathbf{\nu},\quad\text{where}\quad\mathbf{\nu}\sim\mathcal{N}(\mathbf{0}, \sigma^{2}\mathbf{I}). \tag{1}\]

Here, the ground-truth image \(\mathbf{x}\in\mathbb{R}^{NC}\) is contaminated with AWGN of noise-level \(\sigma\), resulting in observed image \(\mathbf{y}\in\mathbb{R}^{NC}\). In the cases of grayscale and color images, we consider \(\mathbf{x},\mathbf{y}\) as vectors in \(\mathbb{R}^{N}\) or \(\mathbb{R}^{N3}\), respectively. For convenience and clarity of notation, we denote images in the vectorized form, and any linear operation on an image as a matrix vector multiplication (see Table I for details). In implementation, fast algorithms are used and these matrices are not actually formed, except when explicitly mentioned.

We frame our signal-recovery problem in terms of a (given) \(s_{c}\)-strided convolutional dictionary \(\mathbf{D}\in\mathbb{R}^{NC\times QM}\), with \(Q=N/s_{c}^{2}\), i.e. the columns of \(\mathbf{D}\) are formed by integer translates of a set of \(M\) (vectorized) 2D convolutional filters, each having \(C\) channels. We assume \(\exists\,\mathbf{z}\in\mathbb{R}^{QM}\;\mathrm{s.\;t.}\;\mathbf{x}\approx\mathbf{D}\mathbf{z}\). The rich works of sparse-representation and compressed-sensing provide guarantees based on assumptions of sparsity in \(\mathbf{z}\) and regularity on the columns of \(\mathbf{D}\)[8]. We refer to \(\mathbf{z}\) as our sparse-code, latent-representation, or subband-representation of \(\mathbf{x}\).

A popular classical paradigm for estimating \(\mathbf{x}\) from an observed noisy \(\mathbf{y}\) is the Basis Pursuit DeNoising (BPDN) model,

\[\underset{\mathbf{z}}{\text{minimize}}\;\frac{1}{2}\|\mathbf{y}-\mathbf{D}\mathbf{z}\|_{2}^{2 }+\lambda\psi(\mathbf{z}), \tag{2}\]

where \(\psi:\mathbb{R}^{QM}\rightarrow\mathbb{R}_{+}\) is a chosen regularization function. The Lagrange-multiplier term \(\lambda>0\) provides a trade-off between satisfying observation consistency and obeying the prior-knowledge encoded by \(\psi\). A popular approach to solving (2) is the proximal-gradient method (PGM) [9], involving the _proximal-operator_ of \(\psi\), defined as

\[\mathbf{prox}_{\tau\psi}(\mathbf{v})\coloneqq\operatorname*{arg\,min}_{\mathbf{x}}\; \tau\psi(\mathbf{x})+\frac{1}{2}\|\mathbf{x}-\mathbf{v}\|_{2}^{2},\quad\tau>0. \tag{3}\]

PGM can be understood as a fixed point iteration involving the iterative application of a gradient-descent step on the \(\ell_{2}\) term of (2) followed by application of the proximal operator of \(\psi\),

\[\mathbf{z}^{(k+1)}=\mathbf{prox}_{\tau\psi}(\mathbf{z}^{(k)}-\eta\mathbf{D}^{T}(\mathbf{D}\mathbf{z }^{(k)}-\mathbf{y})), \tag{4}\]

where \(\tau=\eta\lambda\), and \(\eta>0\) is a step-size parameter.

When \(\psi\) is the sparsity-promoting \(\ell_{1}\)-norm, the proximal operator is given in closed-form by element-wise soft-thresholding,

\[\mathrm{ST}_{\tau}(\mathbf{z})=\mathbf{z}\circ\left(1-\frac{\tau}{|\mathbf{z}|}\right)_{+}, \tag{5}\]

where \((\cdot)_{+}\) denotes projection onto the positive orthant \(\mathbb{R}_{+}\). The resulting PGM iterations are commonly referred to as the Iterative Soft-Thresholding Algorithm (ISTA) [9].

More sophisticated priors (\(\psi\)) can be used to obtain better estimates of our desired ground-truth image by exploiting correlations between "related" image-pixels. One such prior is _group-sparsity_,

\[\psi(\mathbf{z})=\sum_{\begin{subarray}{c}m=1\\ j=1\end{subarray}}^{M,Q}\sqrt{\sum_{i=1}^{Q}\Gamma_{ij}\mathbf{z}_{m}[i]^{2}}=\| \sqrt{(\mathbf{I}_{M}\otimes\mathbf{\Gamma})\mathbf{z}^{2}}\|_{1}, \tag{6}\]

where \(\mathbf{\Gamma}\in\mathbb{R}_{+}^{Q\times Q}\) is a row-normalized adjacency matrix (i.e. \(\|\mathbf{\Gamma}_{:}\|_{1}=1\)), and \(\cdot^{2}\) and \(\sqrt{\cdot}\) are taken element-wise. Group-sparse regularization may be understood as encouraging similar latent-pixels to share the same channel-wise sparsity pattern, and has been shown to improve denoising performance under classical patch-based sparse coding methods [10], as well as recent interpretably constructed DNNs [2].

In general, the group-sparse regularizer (6) does not have a closed form proximal-operator. Motivated by the operator proposed in [2], we propose an approximate solution, group-thresholding,

\[\mathrm{GT}_{\tau}(\mathbf{z};\,\mathbf{\Gamma})=\mathbf{z}\circ\left(1-\frac{\tau}{\sqrt{ (\mathbf{I}_{M}\otimes\mathbf{\Gamma})\mathbf{z}^{2}}}\right)_{+}. \tag{7}\]

Note that the operator proposed in Lecouat et. al [2] is equivalent to (7) when the adjacency matrix is row-normalized. This approximate solution has the desirable property of reducing to element-wise soft-thresholding (5) when \(\mathbf{\Gamma}\) is the identity matrix.

The BPDN (2) problem can be made more expressive by opting to learn an optimal dictionary from a dataset of noisy images \(\mathcal{D}=\{\mathbf{y}\}\). We express the (convolutional) dictionary learning problem as,

\[\underset{\{\mathbf{z}\},\mathbf{D}\in\mathcal{C}}{\text{minimize}}\;\;\sum_{\mathbf{y}\in \mathcal{D}}\frac{1}{2}\|\mathbf{y}-\mathbf{D}\mathbf{z}\|_{2}^{2}+\lambda\psi(\mathbf{z}), \tag{8}\]

\begin{table}
\begin{tabular}{|l|l|} \hline \hline \(\mathbf{x}\in\mathbb{R}^{NC}\) & a vector valued image with \(N=N_{1}\times N_{2}\) pixels, \\  & and vectorized channels, \(\mathbf{x}=[\mathbf{x}_{1}^{T},\cdots,\mathbf{x}_{N}^{T}]^{T}\). \\ \hline \(\mathbf{x}_{\tau}\in\mathbb{R}^{N}\) & the \(c\)-th subband-feature-map/channel of \(\mathbf{x}\). \\ \hline \(\mathbf{x}_{m}[i]\in\mathbb{R}^{C}\) & the \(n\)-th pixel of \(\mathbf{x}\), \(n\in[1,N]\). \\ \hline \(\mathbf{x}_{m}[i]\in\mathbb{R}\) & the \(n\)-th pixel of the \(c\)-th channel of \(\mathbf{x}\). \\ \hline \(n\in[1,N]\times[1,N_{2}]\) & the spatial coordinates of the \(n\)-th pixel of \(\mathbf{x}\). \\ \hline \(n\)-th pixel of \(\mathbf{x}\). \\ \hline \(\mathbf{x}\in\mathbb{R}^{N}\) & the element-wise product of two vectors. \\ \hline \(\mathbf{D}\in\mathbb{R}^{NC\times QM}\) & a 2D \(M\) \(C\) channel synthesis convolution \\  & operate with stride \(s_{c}\), where \(Q=N/s_{c}^{2}\). \\ \hline \(D^{T}\in\mathbb{R}^{QM\times NC}\) & a 2D \(C\) to \(M\) channel analysis convolution \\  & operator with stride \(s_{c}\), where \(Q=N/s_{c}^{2}\). \\ \hline \(\mathbf{U}\in\mathbb{R}^{QM\times N}\) & a \(Q\times N\) matrix with elements \(\mathbf{U}_{i}\in\mathbb{R}\). \\ \hline \(\mathbf{U}_{i}\in\mathbb{R}^{N}\), \(\mathbf{U}_{i}\in\mathbb{R}^{Q}\) & the \(i\)-th row, \(j\)-th column of matrix \(\mathbf{U}\). \\ \hline \(\mathbf{U}\otimes\mathbf{V}\in\mathbb{R}^{QM\times NC}\) & Kronecker product of \(\mathbf{U}\in\mathbb{R}^{Q\times N}\) and \(\mathbf{V}\in\mathbb{R}^{MX\times C}\), i.e. the block matrix with \(\mathbf{V}_{i}\) scaled by \(\mathbf{U}_{ij}\) \(\forall\,i.j\). \\ \hline \(\mathbf{I}_{N}\in\mathbb{R}^{MX\times N}\) & the \(N\) by \(N\) identity matrix. \\ \hline \(\mathbf{y}=(\mathbf{I}_{C}\otimes\mathbf{U})\mathbf{x}\) & the matrix \(\mathbf{U}\) applied channel-wise, \\  & \(\mathbf{z}_{b}=\mathbf{U}\mathbf{z}_{b}\in\mathbb{R}^{Q}\) \(\forall\,1\leq c\leq C\). \\ \hline \(\mathbf{y}=\mathbf{\nabla}_{\mathbf{x}}=(\mathbf{V}\otimes\mathbf{I}_{N})\mathbf{x}\) & the matrix \(\mathbf{V}\) applied pixel-wise, \\  & i.e. \(\mathbf{y}[i]=\mathbf{V}\mathbf{x}[i]\in\mathbb{R}^{M}\), \(\forall\,1\leq i\leq N\). \\ \hline \hline \end{tabular}
\end{table} TABLE I: Notation
where constraint set \(\mathcal{C}=\{\mathbf{D}\,:\,\|\mathbf{D}_{.j}\|_{2}^{2}\leq 1\ \forall\,j\}\) ensures that the regularization term is not rendered useless by an arbitrary scaling of latent coefficients. Solving (8) generally involves alternating sparse-pursuit (ex. (4)) and a dictionary update with fixed sparse-codes (ex. projected gradient descent) [11].

### _Unrolled and Dictionary Learning Networks_

Approaches in [12, 13, 14] explore the construction of DNNs as unrolled proximal gradient descent machines with proximal-operators that are implemented by a black-box CNN, learned end-to-end. Although these methods contribute to more principled DNN architecture design in image-processing, their use of black-box neural networks, such as UNets [15] and ResNets [16], ultimately side-step the goal of full interpretability. In contrast, our previous work CDLNet [1] introduces a CNN as a direct parameterization of convolutional PGM (4) with an \(\ell_{1}\) prior, with layers defined as,

\[\mathbf{z}^{(0)}=\mathbf{0},\quad\text{for}\quad k=0,1,\ldots,K-1, \tag{9}\] \[\mathbf{z}^{(k+1)}=\mathrm{ST}_{\mathbf{\tau}^{(k)}}\left(\mathbf{z}^{(k)}- \mathbf{A}^{(k)}{}^{T}(\mathbf{B}^{(k)}\mathbf{z}^{(k)}-\mathbf{y})\right),\] \[\mathbf{\tau}^{(k)}=\mathbf{\tau}_{0}^{(k)}+\hat{\sigma}\mathbf{\tau}_{1}^{( k)},\quad\hat{\mathbf{x}}=\mathbf{D}\mathbf{z}^{(K)}.\]

Parameters \(\Theta=\{\mathbf{D},\,\{\mathbf{A}^{T}(k),\,\mathbf{B}^{(k)},\,\mathbf{\tau}_{0}^{(k)},\mathbf{ \tau}_{1}^{(k)}\}_{0=1}^{K-1}\}\) are optimized by back-propagation of a supervised or unsupervised loss function. In this manuscript, we extend the formulation and direct parameterization of CDLNet by introducing a novel implementation of the group-sparsity prior, embodied in the proposed GroupCDL architecture (see Section III). We also show that the noise-adaptive thresholding of CDLNet, derived from BPDN (2), extends to GroupCDL.

Zheng et. al [17] propose a DNN architecture based on a classical dictionary learning formulation of image denoising. However, this network heavily employs black-box models such as UNets [15] and multi-layer perceptrons (MLPs). Our proposed method differentiates itself by using a direct parameterization of variables present in the classical proximal gradient method (4) with a group-sparsity regularizer (6). Furthermore, Zheng et. al's experimental setup does not match a bulk of the existing image denoising literature (by training on a larger set of images) and their network exists in the ultra-high parameter count regime (\(\approx 17\) M), making a fair comparison beyond the scope of this paper.

Directly parameterized dictionary learning networks [1, 2, 3, 4, 5, 18] have gained some popularity in recent years due to their simple design and strong structural similarities to popular ReLU-activation DNNs. This connection was first established in the seminal work of Gregor et. al [19] in the form of the Learned Iterative Shrinkage Thresholding Algorithm (LISTA). Here, we build upon this literature by proposing a novel nonlocal operator (11) for the convolutional dictionary learning formulation of a DNN, derived from a group-sparsity prior (6). We also demonstrate that such a network can compete well with (and sometimes outperform) state-of-the-art methods, without sacrificing interpretability.

Lecouat et. al [2] propose a nonlocal CNN derived from a patch-based dictionary learning algorithm with a group-sparsity prior, dubbed GroupSC. It is well established that the independent processing of image patches and subsequent overlap and averaging (path-processing) is inherently suboptimal to the convolutional model, due to the lack of consensus between pixels in overlapping patch regions [4]. Our method is in-part inspired by GroupSC, but proposes a novel version of the group-sparsity mechanism adapted to the convolutional model and fast application of the network at inference.

### _Nonlocal Networks_

The nonlocal self-similarity prior in image-restoration DNNs is commonly formulated with OW-NLSS to manage its quadratic complexity [2, 6]. The overlap is especially important to ensure that artifacts do not occur on local-window boundaries. Despite such networks often being formulated as CNNs, their window-based inference ultimately diminishes the powerful shift-invariance prior and increases computational cost due to additional processing of overlapping regions (see Section III-B).

To reduce computational burden and correctly account for dependencies between neighboring local windows, we propose a novel sliding-window NLSS, enabled by sparse matrix arithmetic. Recent works have proposed other so-called "sparse attention" mechanisms, however, they have either not been in the context of image restoration [20], not employed a sliding-window [21], or have employed a complicated hashing algorithm to exploit extremely long-range dependencies [22].

Fig. 1: The GroupCDL Architecture. The network begins with no prior of group-sparsity (\(\mathbf{\Gamma}^{(0)}=\mathbf{I}\)). In the second layer, and each subsequent \(\Delta K\) layers, the adjacency matrix \(\mathbf{\Gamma}^{(k)}\) is updated by a row-normalized NLSS computation on the latent representation \(\mathbf{z}^{(k)}\). NLSS is computed with dense arithmetic (on image patches) during training, and with sparse arithmetic (on the entire image) during inference.
## III Proposed Method

We consider the problem of image restoration under the AWGN model (1), though, in principle, the methods presented may be adapted to other degradation models with relative ease. Besides being a fundamental building block of many inverse-problem approaches, AWGN is a popular and successful model for camera noise after white-balance and gamma-correction [23].

### _The GroupCDL Architecture_

We propose a neural network architecture as a direct parameterization of PGM (4) on the convolutional BPDN problem with a group-sparsity prior, dubbed GroupCDL. The GroupCDL architecture is equivalent to replacing the CDLNet [1] architecture's (9) soft-thresholding with group-thresholding w.r.t a row-normalized adjacency matrix \(\boldsymbol{\Gamma}\), as described in Algorithm 1 and shown in Figure 1. Here, noise-adaptive thresholds are computed using parameters \(\boldsymbol{\tau}_{0},\,\boldsymbol{\tau}_{1}\in\mathbb{R}_{+}^{M}\), \(\boldsymbol{A}^{T^{(k)}},\boldsymbol{B}^{(k)}\) are 2D (\(C\) to \(M\) channel, stride-\(s_{c}\)) analysis and (\(M\) to \(C\) channel, stride-\(s_{c}\)) synthesis convolutions, respectively, and \(\boldsymbol{D}\) is our 2D (\(M\) to \(C\) channel, stride-\(s_{c}\)) synthesis convolutional dictionary. For an input noisy image \(\boldsymbol{y}\in\mathbb{R}^{NC}\), our latent representation is thus of the form \(\boldsymbol{z}\in\mathbb{R}^{QM}\), where \(Q=N/s_{c}^{2}\).

The adjacency matrix of the group-sparsity prior (\(\boldsymbol{\Gamma}\in\mathbb{R}_{+}^{Q\times Q}\)) encodes similarity between latent subband pixels \(\boldsymbol{z}[i]\), \(\boldsymbol{z}[j]\)\(\forall\,i,\,j\). To manage computational complexity while staying true to the convolutional inductive bias of the network, we form this adjacency using a local sliding-window of size \(W\times W\). Motivated by the nonlocal similarity computations of black-box networks [6], we compute the similarity after transforming \(\boldsymbol{z}[i]\) and \(\boldsymbol{z}[j]\) along the channel dimension. Specifically, we first compute similarities at the \(k\)-th layer of the network as,

\[\boldsymbol{S}_{ij}^{(k)}=\begin{cases}-\|\boldsymbol{W}_{\theta}\boldsymbol{z }^{(k)}[i]-\boldsymbol{W}_{\phi}\boldsymbol{z}^{(k)}[j]\|_{2}^{2},&\|\vec{i}- \vec{j}\|_{\infty}\leq W\\ -\infty,&\text{otherwise}\end{cases} \tag{10}\]

where \(\boldsymbol{W}_{\theta},\boldsymbol{W}_{\phi}\in\mathbb{R}^{M_{h}\times M}\) are learned pixel-wise transforms shared across all layers. That is, similarities \(\boldsymbol{S}_{ij}^{(k)}\) are only computed for spatial locations \(i\) and \(j\) within a \(W\times W\) window centered on \(i\). The similarity matrix is then normalized via a row-wise softmax operation. To reduce computational complexity, we only compute similarity every \(\Delta K\) layers. We employ a convex combination of this normalized similarity and the adjacency of the previous layer (\(\boldsymbol{\Gamma}^{(k-1)}\)) with a learned parameter \(\gamma\in[0,1]\) (see Alg. 1), to ensure smooth updates. We consider circular boundary conditions when forming nonlocal windows in (10), resulting in a block-circulant with circulant block sparsity pattern for \(\boldsymbol{S}\) and \(\boldsymbol{\Gamma}\), as depicted in Figure 2.

```
1Input: noisy image \(\boldsymbol{y}\), estimated noise-level \(\hat{\sigma}\) ;
2Parameters:\(\Theta=\{\gamma,\,\boldsymbol{W}_{\{\theta,\phi,\alpha,\beta\}},\,\boldsymbol{D},\, \{\boldsymbol{A}^{T^{(k)}},\,\boldsymbol{B}^{(k)},\,\boldsymbol{\tau}_{\{0,1 \}}^{(k)}\}_{\alpha=1}^{K-1}\}\) ;
3Preprocess:\(\tilde{\boldsymbol{y}}=\boldsymbol{y}-\text{mean}(\boldsymbol{y})\) ;
4Initialize:\(\boldsymbol{z}^{(0)}=\boldsymbol{0},\,\boldsymbol{\Gamma}^{(0)}=\boldsymbol{I}, \,\boldsymbol{\tau}^{(k)}=\boldsymbol{\tau}_{0}^{(k)}+\hat{\sigma}\boldsymbol {\tau}_{1}^{(k)}\)\(\forall\)\(k\) ;
5for\(k=0,1,\dots,K-1\)do
6//Update row-normalized adjacency
7if\(k=1\)then
8\(\boldsymbol{\Gamma}^{(1)}=\text{softmax}(\boldsymbol{S}^{(1)})\) //Eq. (10)
9elseif\(\text{mod}(k+1,\,\Delta K)=0\)then
10\(\boldsymbol{\Gamma}^{(k)}=\gamma\,\text{softmax}(\boldsymbol{S}^{(k)})+(1- \gamma)\boldsymbol{\Gamma}^{(k-1)}\) //Eq. (10)
11else
12\(\boldsymbol{\Gamma}^{(k)}=\boldsymbol{\Gamma}^{(k-1)}\) ;
13\(\boldsymbol{r}=\boldsymbol{A}^{T^{(k)}}(\boldsymbol{B}^{(k)}\boldsymbol{z}^{(k) }-\tilde{\boldsymbol{y}})\);
14\(\boldsymbol{z}^{(k+1)}=\text{GT}_{\boldsymbol{\tau}^{(k)}}\left(\boldsymbol{z}^{( k)}-\boldsymbol{r};\boldsymbol{\Gamma}^{(k)}\right)\) //Eq. (11)
15Output:\(\hat{\boldsymbol{x}}=\boldsymbol{D}\boldsymbol{z}^{(K)}+\text{mean}(\boldsymbol{y})\) ;
```

**Algorithm 1**Group-sparse Convolutional Dictionary Learning Network (GroupCDL) Forward Pass

Mimicking the use of subband transforms in the similarity computation (10), we introduce two additional subband transforms, \(\boldsymbol{W}_{\alpha}\in\mathbb{R}^{M\times M_{h}},\boldsymbol{W}_{\beta} \in\mathbb{R}_{+}^{M\times M_{h}}\), into the group-thresholding operation,

\[\begin{split}\text{GT}_{\boldsymbol{\tau}}(\boldsymbol{z}; \,\boldsymbol{\Gamma})=\boldsymbol{z}\circ\left(1-\frac{\boldsymbol{\tau}}{ \boldsymbol{\xi}}\right)_{+},\\ \boldsymbol{\xi}=\overline{\boldsymbol{W}_{\beta}}\sqrt{( \boldsymbol{I}_{M_{h}}\otimes\boldsymbol{\Gamma})(\overline{\boldsymbol{W}_{ \alpha}^{T}}\boldsymbol{z})^{2}},\end{split} \tag{11}\]

,

\(\boldsymbol{\xi}=\overline{\boldsymbol{W}_{\beta}}\sqrt{(\boldsymbol{I}_{M_{h}} \otimes\boldsymbol{\Gamma})(\overline{\boldsymbol{W}_{\alpha}^{T}}\boldsymbol {z})^{2}}\),

where \(\boldsymbol{\xi}\in\mathbb{R}_{+}^{QM}\) contributes to the image-adaptive spatially varying threshold. Here, \(\overline{\boldsymbol{W}}\) refers to a pixel-wise application of a matrix \(\boldsymbol{W}\) (see Table I). In contrast to (7), \(\boldsymbol{W}_{\alpha}\) allows the adjacency-weighted energy of the latent representation to be computed in a compressed subband domain (by setting \(M_{h}<<M\)). Then, \(\boldsymbol{W}_{\beta}\) maps this energy back to the uncompressed subband domain (\(M\) channels), pixel-wise. In Section IV-E, we empirically show that the use of a compressed subband domain has a positive impact on denoising performance and an even greater impact on reducing inference time.

### _Sliding-window vs. Patch based Self-Attention_

The SW-NLSS employed by GroupCDL (10) is favorable to the independent OW-NLSS employed by GroupSC [2] and black-box DNNs [6, 24], because it naturally encourages agreement on overlapping regions and centers the nonlocal windows on each pixel. As shown in Figure 2, OW-NLSS additionally incurs computational overhead by processing overlapping pixels multiple times. This burden inherent to OW-NLSS can be expressed in terms of the image dimensions \(N=N_{1}\times N_{2}\), window-size \(W\times W\), and window-stride \(s_{w}\times s_{w}\). We express the burden factor as a ratio of the number of pixels processed by a single OW-NLSS layer over an SW-NLSS layer,

\[\frac{N_{1}/s_{w}\times N_{2}/s_{w}\times W^{2}}{N_{1}\times N_{2}}=\frac{W^{2} }{s_{w}^{2}}. \tag{12}\]

Common nonlocal window sizes, \(45\times 45\), and window-strides, \(7\times 7\), such as used by NLRN [6], make this burden factor 41 times the computational complexity of an equivalent SW-NLSS. GroupCDL's use of strided convolution may add an additional \(s_{c}^{2}\times\) computational benefit compared to common NLSS implementations by computing similarities over a reduced spatial dimension \(Q=N/s_{c}^{2}\). We further explore the relation between computation time and denoising performance of these two NLSS inference methods in Section IV-D.
### _Group-Thresholding vs. Black-box Attention_

Nonlocal self-similarity is used across domains in DNNs, from transformer architectures [21] to nonlocal image restoration networks [6, 24]. The underlying formula behind these methods is most commonly dot-product attention (DPA), given below,

\[\mathbf{z}^{(k+1)} =(I_{M_{\mathrm{out}}}\otimes\mathbf{\Gamma})\overline{\mathbf{W}_{v}}\mathbf{ z}^{(k)} \tag{13}\] \[\mathbf{\Gamma} =\mathbf{softmax}(\mathbf{S}^{(k)})\] (14) \[\mathbf{S}^{(k)}_{ij} =\frac{\mathbf{z}^{(k)}[j]^{T}\mathbf{W}_{q}^{T}\mathbf{W}_{k}\mathbf{z}^{(k)}[i]} {\sqrt{M_{h}}}, \tag{15}\]

where \(\mathbf{z}^{(k)}\in\mathbb{R}^{NM_{\text{in}}}\), \(\mathbf{W}_{q},\mathbf{W}_{k},\in\mathbb{R}^{M_{h}\times M_{\text{in}}}\), \(\mathbf{W}_{v}\in\mathbb{R}^{M_{\text{out}}\times M_{\text{in}}}\), and \(\mathbf{z}^{(k+1)}\in\mathbb{R}^{NM_{\text{out}}}\). Learned matrices \(\mathbf{W}_{q},\mathbf{W}_{k},\mathbf{W}_{v}\) are understood to transform the input signal \(\mathbf{z}^{(k)}\) to so-called query, key, and value signals.

Both DPA and the proposed GT (11) make use of a normalized adjacency matrix (\(\mathbf{\Gamma}\)), computed in an asymmetric feature domain. Both use this adjacency to weight the current spatial features, identically over channels. However, in DPA, the weighting directly results in the layer's output (via matrix multiplication, see (13)), whereas in GT, this weighting informs a spatially adaptive soft-thresholding.

The proposed GT's decoupling of adjacency application and output dimension is key in allowing group-thresholding to be computationally efficient, as the adjacency matrix-vector multiplication can be performed in a compressed subband domain. In contrast, DPA operating in a compressed feature domain (\(M_{\mathrm{out}}<<M_{\text{in}}\)) would harm the capacity of the network's latent representation. In Section IV-E we show empirical evidence for favoring the negative-norm similarity in GT over the dot-product similarity of DPA.

## IV Experimental Results

### _Experimental Setup_

**Architecture**: We denote the network detailed in Algorithm 1 as GroupCDL. GroupCDL and CDLNet are trained with noise-adaptive thresholds (\(\mathbf{\tau}^{(k)}=\mathbf{\tau}^{(k)}_{0}+\hat{\sigma}\mathbf{\tau}^{(k)}_{1}\)) unless specified using the -B suffix, indicating the models are noise-blind (\(\mathbf{\tau}^{(k)}=\mathbf{\tau}^{(k)}_{0}\)). The hyperparameters for these architectures are given in Table II, unless otherwise specified.

**Dataset and Training**: Let \(f_{\Theta}\) denote the GroupCDL DNN as a function of parameters \(\Theta\). Let \(\mathcal{D}=\{(\mathbf{y},\sigma,\mathbf{x})\}\) denote a dataset of noisy and ground-truth natural image pairs, with noise-level \(\sigma\). Grayscale (and color) GroupCDL models are trained on the (C)BSD432 [25] dataset with the supervised mean squared error (MSE) loss,

\[\underset{\begin{subarray}{c}\mathbf{W}_{q},\mathbf{W}_{q},\mathbf{W}_{q},\\ \mathbf{W}_{2}\geq 0,\ \sigma\in[0],\\ D\in\mathcal{C},\ \{\mathbf{\tau}^{(k)}\geq 0\}_{1}^{K-1},\\ \{A^{(k)}\in\mathcal{C},\ B^{(k)}\in\mathcal{C}\}_{2}^{K-1}\end{subarray}}{ \text{minimize}}\sum_{\begin{subarray}{c}\mathbf{y},\sigma,\mathbf{x}\}\in\mathcal{D} \\ \|f_{\Theta}(\mathbf{y},\sigma)-\mathbf{x}\|_{2}^{2}, \tag{16}\]

\(\{\mathbf{A}^{(k)}\in\mathcal{C},\ B^{(k)}\in\mathcal{C}\}_{2}^{K-1}\)

where \(\mathcal{C}=\{\mathbf{D}:\|\mathbf{D}_{:}\|_{2}^{2}\leq 1\ \forall j\}\). We use the Adam optimizer with default parameters [26], and project the network parameters onto their constraint sets after each gradient step. The dataset is generated online with random crops, rotations, flips, and AWGN of noise-level \(\sigma\) sampled uniformly within \(\sigma^{\mathrm{train}}\) for each mini-batch element. All models are trained with the same hyperparameters given in [1], however, GroupCDL models are trained for 270k iterations with a batch-size of 32.

Test and validation performance is evaluated on several datasets. The dataset name, along with (arithmetic) average dimensions, are provided to better understand reported inference timings: Set12 (362 \(\times\) 362), CBSD68 [25] (481 \(\times\) 321), Urban100 [27] (1030 \(\times\) 751), and NikoSet10\({}^{2}\) (1038 \(\times\) 779).

\begin{table}
\begin{tabular}{c c c c c c} \hline Name & Task & \(K\) & \(M\) & \(M_{h}\) & \(W\) \\ \hline CDLNet(-S,-B) & Gray & 30 & 169 & - & - \\ GroupCDL(-S,-B) & Gray & 30 & 169 & 64 & 35 \\ CDLNet(-S,-B) & Color & 24 & 96 & - & - \\ GroupCDL(-S,-B) & Color & 24 & 96 & 48 & 35 \\ \hline \end{tabular}
\end{table} TABLE II: Architectures of the GroupCDL models, CDLNet models, and variants presented in the experimental section. We use \(C=3\) and \(C=1\) for color and grayscale denoising networks, respectively. A filter size of \(7\times 7\) is used for all models. Conv-stride \(s_{c}=2\), adjacency update period \(\Delta K=5\), is used unless otherwise specified.

Fig. 2: (a) In OW-NLSS, the input image is divided into overlapping windows (of size \(W\times W\) and with window-stride \(s_{w}\times s_{w}\)), processed independently via a DNN with dense self-attention. The denoised windows are then placed in their original positions and averaged on their overlaps. (b) In the proposed SW-NLSS, the entire image is processed in a single forward pass, made possible by sparse matrix arithmetic. The adjacency matrix has a block-circulant with circulant blocks (BCCB) sparsity pattern, where the number of non-zeros in each row/column is at most \(W^{2}\). The adjacency matrix is computed in the subband domain, with spatial dimension \(Q=N/s_{c}^{2}\), where \(s_{c}\) is the convolution stride. Hence, the effective image-domain window-size is \(s_{c}W\times s_{c}W\).
**Training Initialization**: CDLNet models are initialized as ISTA with \(\mathbf{\tau}_{0}=10^{-2},~{}\mathbf{\tau}_{1}=0\), and a base dictionary \(\mathbf{D}\) that has been spectrally normalized. Details are given in [1]. GroupCDL models are initialized with a trained CDLNet model. Pixel-wise transforms \(\mathbf{W}_{\{\theta,\phi,\alpha\}}\) are initialized with the same weights drawn from a Glorot Uniform distribution centered at zero [28], and \(\mathbf{W}_{\beta}\) is drawn from a similar Glorot Uniform distribution, tailored to the positive orthant. We initialize parameter \(\gamma=0.8\).

**Group-Thresholding Training vs. Inference**: A GroupCDL model, with nonlocal window-size \(W\) and conv-stride \(s_{c}\), is trained using image crops of dimension \(s_{c}W\times s_{c}W\) such that a single nonlocal window is used during training. Dense arithmetic is used in construction and application of the normalized adjacency matrix \(\mathbf{\Gamma}^{(k)}\) throughout training.

On inference of a noisy image \(\mathbf{y}\in\mathbb{R}^{NC}\), with latent representation \(\mathbf{z}\in\mathbb{R}^{QM}\) (\(Q=N/s_{c}^{2}\)), the adjacency matrix \(\mathbf{\Gamma}\in\mathbb{R}_{+}^{Q\times Q}\) is constructed with a block circulant with circulant blocks (BCCB) sparsity pattern and sparse matrix arithmetic is used. The adjacency matrix requires an allocation of \(Q\times W^{2}\times\texttt{sizeof}\) (float) bytes. For a high resolution image of size \(1024\times 1024\) (such as images in the Urban100 dataset [27]) and a conv-stride of \(2\), this results in roughly \(2.6\) GB of memory required to store \(\mathbf{\Gamma}^{(k)}\) and \(\mathbf{\Gamma}^{(k-1)}\), which is by and large the memory consumption of inference.

**Hardware**: All models were trained on a single core Intel Xeon CPU with 2.90 GHz clock and a single NVIDIA A100 GPU. CDLNet pre-training takes roughly 6 hours, and GroupCDL training takes approximately an additional 36 hours. Note that training and inference can take place on GPUs with as low as 16 GB of memory. For code-base compatibility reasons, all inference timings in Tables III, IV were determined by running models (provided by the authors of the respective papers), and our trained GroupCDL/CDLNet models, on a single core Intel Xeon CPU with 2.90 GHz clock and a NVIDIA Quadro RTX-8000 GPU.

### _Single Noise-Level Performance_

In this section, we demonstrate the fast inference speed and competitive denoising performance of the proposed GroupCDL. All models are trained on a single noise-level and tested at the same noise-level (\(\sigma^{\rm train}=\sigma^{\rm test}\)). We compare GroupCDL to its fully convolutional counterpart (CDLNet), the non-learned nonlocal method BM3D [29, 30], popular local and nonlocal black-box CNNs [6, 31, 32], and a patch-processing dictionary learning based nonlocal DNN (GroupSC) [2].

Table III shows the grayscale denoising performance and inference speed of the aforementioned models across several common datasets. We include a learned parameter count as a crude measure of expressivity of the model. The group-sparsity prior of GroupCDL significantly increases denoising performance compared to the unstructured sparsity prior of CDLNet, though at a detriment to inference speed. We observe that GroupCDL has denoising performance superior to other dictionary learning based networks using group sparsity prior (GroupSC) and competitive performance with state-of-the-art black-box methods (GCDN, NLRN). Most notably, GroupCDL has the fastest inference runtime among nonlocal methods, with at least an order of magnitude difference. These timing differences between GroupCDL and NLRN (or GroupSC) correspond well with the analysis in Section III-B regarding the use of sliding-window sparse nonlocal processing vs. overlapping-window nonlocal processing.

Table IV shows the color image denoising performance and inference speed of the aforementioned classical benchmark [29, 30], local DNN [31], nonlocal patch-processing DNN [2], and black-box nonlocal DNN [24] against the proposed GroupCDL. We observe that GroupCDL outperforms the interpretable patch-processing dictionary learning DNN (GroupSC) and CNNs (DnNN, CDLNet). GroupCDL performs competitively to the black-box nonlocal DNN (RNAN [24]) at a faction of the learned parameter count and inference time.

Figures 3 and 4 highlight the qualitative differences between the previously mentioned methods. We observe that the group-sparsity prior of GroupCDL is instrumental in suppressing unwanted denoising artifacts (present in CDLNet's results), especially in constant image regions where edges are otherwise hallucinated (see Figure 4 (g) vs (j)). Note that GroupSC produces low spatial-frequency artifacts throughout the image, likely introduced by independent processing of image patches (see Figure 4 (c,h,m)). Further, GroupCDL's results appear qualitatively indistinguishable to those of state-of-the-art black-box models, at a fraction of the inference time.

### _Noise-Level Generalization_

In this section, we look at the denoising performance of trained denoising DNNs on inference of input images with noise-levels (\(\sigma^{\rm test}\)) outside their training noise-level range (\(\sigma^{\rm train}\)). Figure 5 shows the performance of grayscale image denoisers, trained over the range \(\sigma^{\rm train}=[20,30]\). The figure

Fig. 3: Visual comparison for grayscale denoising models (\(\sigma^{\rm test}=\sigma^{\rm train}=25\)) on the starfish test image. PSNR (dB)/\(100\times\)SSIM reported for each image.
shows, as also noted in [1, 3, 33], black-box DNNs (such as DnCNN [31]) and dictionary learning DNNs without noise-adaptive thresholds exhibit a catastrophic failure on inference above their training noise-level range. A less striking but analogous failure is seen on inference below the training noise-level, where a mere plateau in performance is obtained as the denoising problem becomes easier.

In addition to the observations noted in [1], Figure 5 shows that the proposed novel group-thresholding scheme (11) is able to obtain near-perfect noise-level generalization (w.r.t GroupCDL-S performance). This serves as empirical evidence for the interpretation of the unrolled network as performing some approximate/accelerated group-sparse BPDN, as the noise-adaptive thresholds (\(\mathbf{\tau}=\mathbf{\tau}_{0}+\hat{\sigma}\mathbf{\tau}_{1}\)) appear to correspond very well to their classical counter-parts from which they are derived.

We further investigate the behavior of the proposed group-thresholding across noise-levels in Figure 6. The figure shows

\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Params} & \multirow{2}{*}{time (s)} & \multicolumn{4}{c}{Noise-level (\(\sigma\))} \\  & & & 10 & 15 & 25 & 30 & 50 \\ \hline BM3D [29] & - & 0.019 & 34.56 & 33.49 & 30.68 & 28.05 & 27.36 \\ DaCNN [31] & 668k & 0.054 & 36.31 & 33.99 & 31.31 & 28.01 \\ CDNet & 694k & 0.009 & 36.31 & 34.04 & 31.39 & 30.52 & 28.18 \\ GronpeC [2] & 119k & 40.81 & 36.40 & 34.11 & 31.44 & 30.58 & 28.05 \\ RNAN [24] & 8.96M & 1.92 & **36.60** & - & - & **30.73** & 28.35 \\ GroupCDL-S & 698k & 0.39 & 36.43 & **34.19** & **31.58** & 30.70 & **28.37** \\ \hline \hline \end{tabular}
\end{table} TABLE IV: Color Denoising performance, PSNR (dB), and GPU inference runtimes on CBSD68 [25]. All learned methods are trained on CBSD432 [25] (\(\sigma=\sigma^{\rm train}=\sigma^{\rm test}\)).

Fig. 4: Visual comparison of deep denoisers. Top and middle rows: color denoisers for \(\sigma^{\rm train}=\sigma^{\rm test}=50\). Bottom row: grayscale denoisers \(\sigma^{\rm train}=\sigma^{\rm test}=25\). PSNR/\(100\times\)SSIM shown in respective captions.

\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{Dataset} & \multirow{2}{*}{Noise \(\sigma\)} & BM3D [29] & DnCNN [31] & CDLNet [1] & GroupSC [2] & GCDN [32] & NLRN [6] & GroupCDL-S \\  & & - & 556k & 507k & 68k & 6M & 340k & 550k \\ \hline \multirow{3}{*}{Set12} & 15 & 32.37/89.52 & 32.86/90.31 & 32.87/90.43 & 32.85/90.63 & 33.14/90.72 & **33.16**/90.70 & 33.05**/**90.73** \\  & 25 & 29.97/85.04 & 30.44/86.22 & 30.52/86.55 & 30.48/86.74 & 30.78/86.87 & **30.80**/86.89 & 30.75/**86.93** \\  & 50 & 26.72/76.76 & 27.18/78.29 & 27.42/79.41 & 27.14/77.97 & 27.60/79.57 & **27.64**/**90.80** & 27.63**/**80.04** \\ time (s) & & 0.010 & 0.119 & 0.019 & 22.07 & 404.8 & 25.62 & 0.68 \\ \hline \multirow{3}{*}{BDS68 [25]} & 15 & 31.07/87.17 & 31.73/89.07 & 31.74/89.18 & 31.70/**89.63** & 31.83/89.33 & **31.88**/89.32 & 31.82/89.41 \\  & 25 & 28.57/80.13 & 29.23/82.78 & 29.26/83.06 & 29.20/83.36 & 29.35/83.32 & **29.41**/83.31 & 29.38/**83.51** \\  & 50 & 25.62/68.64 & 26.23/71.89 & 26.35/72.69 & 26.17/71.83 & 26.36/**37.89** & **26.47**/72.98 & **26.47**/73.32 \\ time (s) & & 0.011 & 0.039 & 0.02 & 23.63 & 539.7 & 26.66 & 0.65 \\ \hline \multirow{3}{*}{Urban100 [27]} & 15 & 32.35/92.20 & 32.68/92.55 & 32.59/92.85 & 32.72/93.08 & **33.47**/**93.58** & 33.42/93.48 & 33.07/93.40 \\  & 25 & 29.70/87.77 & 29.92/87.97 & 30.03/89.00 & 30.05/89.12 & **30.95**/**90.20** & 30.88/90.03 & 30.61/90.03 \\  & 50 & 25.95/77.91 & 26.28/78.74 & 26.66/81.11 & 26.43/80.02 & **27.41**/81.60 & 27.40/82.44 & 27.29/**83.05** \\ time (s) & & 0.030 & 0.096 & 0.090 & 93.33 & 1580 & 135.8 & 3.56 \\ \hline \hline \end{tabular}
\end{table} TABLE III: Grayscale denoising performance (PSNR (dB)/ \(100\times\)SSIM) and GPU inference runtimes. All learned methods are trained on BSD432 [25] with an MSE loss function (\(\sigma=\sigma^{\rm train}=\sigma^{\rm test}\)). Learned parameter counts are displayed below the method names.
a single input nonlocal window \(\mathbf{y}\) across noise-levels \(\sigma\) and the computed adjacency values of the three types of GroupCDL models (GroupCDL-S, GroupCDL-B, GroupCDL).

In agreement with the catastrophic failure of the noise-level blind GroupCDL-B model of Figure 5, the adjacency visualizations of GroupCDL-B in Figure 6 show a catastrophic failure in the similarity computations of the network above \(\sigma^{\rm train}\), as no structure is found. We observe a similar pattern in the GroupCDL models (with noise-adaptive thresholds) to the visualizations of GroupCDL-S, however, the single noise-level models seem to have more variation in their computed similarities across noise-levels. This could suggest room for improvement in GroupCDL by parametrizing the similarity computations of (7) and (10) to also be noise-adaptive. However, this subtle dissimilarity may also be due to the fact that each row-element for the GroupCDL-S column in Figure 6 is from a different trained model with different weights (i.e. with similarities computed in different domains), whereas the visualizations from the GroupCDL column are all from the same model.

### _Sliding vs. Overlapping Window Nonlocal Processing_

From Figure 2, it is clear that the OW-NLSS strategy (used by NLRN [6] and GroupSC [2]) is able to achieve a denoising to speed trade-off by reducing the amount of overlap between windows, i.e. increasing window-stride (\(s_{w}\)). SW-NLSS can also achieve a similar performance-speed trade-off by instead reducing the nonlocal window-size (\(W\)) during inference.

Fig. 5: Noise-level generalization of different grayscale denoising networks tested on BSD68 [25]. GroupCDL-S is trained at \(\sigma^{\rm test}\) for each point on the graph. All other networks are trained on \(\sigma^{\rm train}=[20,30]\).

Fig. 6: Visualization of normalized adjacency \(\mathbf{\Gamma}_{\hat{i}:}^{(K)}\) for input nonlocal window \(\mathbf{y}\) at noise-levels \(\sigma=10,25,50\). Columns GroupCDL-S, GroupCDL-B, and GroupCDL visualize the adjacency of models trained under conditions of \(\sigma^{\rm train}=\sigma\), \(\sigma^{\rm train}\in[20,30]\) without noise-adaptive thresholds, and \(\sigma^{\rm train}\in[20,30]\) with noise-adaptive thresholds, respectively. Catastrophic failure of GroupCDL-B model is observed for \(\sigma>\sigma^{\rm train}\). The same noise-realization is used across models and noise-levels (with appropriate scaling).

Fig. 7: Inference-time vs. denoising-performance trade-off for GroupCDL. Circle, pentagon, and triangle markers are generated by the same trained GroupCDL model (\(W^{\rm train}=35\)) under different inference strategies (SW-NLSS w/ window-size \(W\), OW-NLSS w/ window-stride \(s_{w}\)). The square markers are each generated by a GroupCDL with a different training window-size \(W^{\rm train}\). Performance (a) PSNR, (b) \(100\times\)SSIM, is evaluated on BSD68 [25] with \(\sigma^{\rm train}=\sigma^{\rm test}=25\). OW-NLSS (serial,parallel) curves are generated via processing independent overlapping windows either sequentially or all at once, respectively. The same noise-realization for the dataset was used across all evaluations plotted. Note that \(W\) corresponds between SW curve markers vertically (the same inference time), and \(s_{w}\) corresponds between OW curve markers horizontally (the same PSNR/SSIM).
Figure 7 plots the denoising performance vs. inference time trade-off attainable by GroupCDL under the SW-NLSS strategy and the OW-NLSS strategy. The SW: \(W^{\rm train}=35\), and OW curves show a single GroupCDL model (trained with a nonlocal window-size \(W^{\rm train}=35\)) under SW-NLSS inference with varying nonlocal window-size \(W^{\rm test}\), and OW-NLSS inference with varying window-stride \(s_{w}\), respectively. Each point in the SW: \(W^{\rm train}=W^{\rm test}\) curve shows the performance of a GroupCDL model trained with a different non-local window-size and performing SW-NLSS inference with their respective training window-size.

First, we observe that SW-NLSS consistently out-performs OW-NLSS across the PSNR-speed and SSIM-speed trade-offs - in both parallel and serial window processing forms of OW-NLSS. This agrees well with the burden-factor analysis in Section III-B. The curves further highlight that competitive denoising performance in OW-NLSS inference is predicated on using a small window-stride, in order to compensate for the neglect of dependencies between overlapping window regions by window-averaging. Second, we observe that increasing the training window-size \(W^{\rm train}\) has diminishing returns on denoising performance. This is consistent with the intuition that non-local similarities of natural images are generally located close to the pixel of interest. Lastly, we observe that the OW-NLSS curves of Figure 7 are not monotonically increasing with smaller window-stride, and in-fact have significant drops in the SSIM curves (Fig. 7 (b), blue triangle and pentagon curves). The source of this behavior is windowing artifacts, highlighted visually in Figure 8. These visualizations show that the denoising-speed trade-off exhibited by OW-NLSS processing comes with the penalty of unnatural artifacts in the form of grid-lines corresponding to the spatial pattern of window overlaps. In contrast, the proposed SW-NLSS does not exhibit windowing artifacts. Instead, as the window-size decreases, SW-NLSS processing transitions to fully convolutional CDLNet processing, and artifacts associated with FCNNs (such as hallucinated edges) are observed.

### _Ablation Studies_

In this section we examine the denoising and inference time performance of the GroupCDL model under different hyper-parameters associated with the proposed group-thresholding operation (11), (10). Table V shows the effect of the update-period parameter (\(\Delta K\)), which determines how often we update the adjacency \(\mathbf{\Gamma}^{(k)}\) in the network (every \(\Delta K\) layers, see Alg. 1). We observe that decreasing the update frequency increases denoising performance, with diminishing returns, at cost to the inference speed of the network.

Table VI shows the effect of employing learned pixel-wise transforms in the similarity computation (10) (\(\mathbf{W}_{\theta}\), \(\mathbf{W}_{\phi}\)) and group-thresholding (11) (\(\mathbf{W}_{\alpha}\), \(\mathbf{W}_{\beta}\)). The table also shows the effect of employing channel reduction in these transforms

\begin{table}
\begin{tabular}{c|c c} \hline \(\Delta K\) & PSNR/\(100\times\)SSIM & time (s) \\ \hline
2 & 30.22/86.88 & 4.01 \\
3 & 30.22/86.87 & 4.72 \\
5 & 30.21/86.87 & 3.47 \\
10 & 30.21/86.87 & 3.24 \\
15 & 30.19/86.79 & 3.18 \\ \hline \end{tabular}
\end{table} TABLE V: Effect of update frequency (\(\Delta K\)). Grayscale denoising performance averaged over the NikoSet10 dataset (\(\sigma^{\rm train}=\sigma^{\rm test}=25\)).

Fig. 8: Comparison of inference-speed/denoising trade-off between OW-NLSS (b-d) and SW-NLSS (f-h) processing by a color GroupCDL model (\(\sigma^{\rm train}=\sigma^{\rm test}=50\), \(W^{\rm train}=35\)). PSNR (dB) / \(100\times\)SSIM / GPU inference-time (s) shown in respective captions. Zoomed-in regions highlight blocking artifacts exist across shown OW-NLSS window-strides (\(s_{w}\)), whereas SW-NLSS processing exhibits no blocking artifacts across inference window-sizes (\(W\)). Yellow arrows (b-d) point to specific blocking artifact boundaries of OW-NLSS. Orange arrows (f) point to edge/texture hallucination artifacts of SW-NLSS with a small windowsize. The inclusion of (d) (\(s_{w}=32\)), demonstrates that blocking artifacts are not merely a result of the effective spatial windowsize (\(s_{c}W=70\)) being divisible by the overlapping window-stride. The same noise-realization is used across all methods (b-d, f-h).
(\(M_{h}<<M=169\)) and a comparison of using the negative distance similarity (as presented in (10)) or, as more commonly used in black-box nonlocal and transformer DNNs, the dot-product similarity (15). From these experiments, we observe that the use of pixel-wise transforms increases denoising performance. Most importantly, we observe only a marginal decrease in performance for setting the latent similarity channel dimension less than the latent subband dimension \(M_{h}<M\). This marginal decrease is met by a massive reduction in GPU inference time, which is predicted well by the channel reduction ration \(M/M_{h}=169/64\approx 8.89/3.47\). This demonstrates one of the advantages of the proposed group-thresholding operation over black-box dot-product attention, in that the latent similarity channel dimension \(M_{h}\) is decoupled from the layer's output channel dimension and can be tuned to achieve a better trade-off between speed and performance.

## V Discussion and Conclusion

GroupCDL adapts the classical, patch-processing based, group-sparsity prior to convolutional sparse coding (CSC) and applies it to the direct-parametrization unrolling frame-work of CDLNet [1]. In contrast to the group-sparsity prior of Lecouat et. al's patch-based dictionary learning network (GroupSC) [2], which employ's overlapping window processing, we formulate our group-sparsity prior on convolutional sparse codes, and in doing so naturally arrive at a sliding-window nonlocal self-similarity consistent with the CSC model. As discussed in Section III-B and empirically validated in Section IV-D, the proposed SW-NLSS enjoys an improved denoising performance over OW-NLSS by properly accounting for correlations between neighboring image regions and centering similarity computations on each latent pixel of interest. The sparse array arithmetic employed at inference time, enables orders of magnitude speed-up for the proposed design compared to state-of-the-art competitor networks (Section IV-B).

Notably, GroupCDL's performance comes without the use of common deep-learning operations, such as batch-normalization [34] or residual learning [31], and instead relies on the tools of classical signal processing and optimization such as basis-pursuit denoising and proximal operators.

The fast inference of GroupCDL is aided by a novel decoupling of the latent subband dimension (\(M\)) from the hidden adjacency/similarity dimension (\(M_{h}\)) (see Equation (11)). This allows the computational bottleneck of sparse-matrix dense-vector multiplication to be tuned without harming the capacity of the latent representation (Table VI) - something which is not achievable in the dot-product attention employed by black-box nonlocal and transformer networks (Section III-B).

Similar to CDLNet [1], GroupCDL is formulated as a direct parameterization of the proximal gradient method (4). We show that this derivation allows for near perfect generalization outside of its training noise-level range (Fig. 5), simply by parametrizing its thresholds as an affine function of the input noise-level, as suggested by the classical BPDN formulation (2) and the universal thresholding theorem [1, 8]. In contrast, black-box networks [31] are shown to fail catastrophically above the noise-level range and simply plateau in performance when the noise-level decreases (i.e. the problem becomes easier). In GroupCDL, generalization is additionally observed in its adjacency matrix (Fig. 6).

In future work, we aim to adapt GroupCDL to other imaging modalities. We believe GroupCDL's speed, performance, interpretability, and robustness are well suited to tackle large signal reconstruction problems with nonlocal image-domain artifacts, such compressed sensing magnetic resonance imaging. The unsupervised learning and demosaicing work of CDLNet [1] may be adapted for GroupCDL to this end.

## Acknowledgments

The authors would like to thank NYU HPC for its computing resources and technical support. The authors are grateful to Che Maria Baez for her linguistic revisions on a preliminary draft of this manuscript.
