AI Wiki中文/EN

Image restoration: separate the measurement from the prior

图像复原

Train a complete residual denoiser, derive circular deblurring and test what a learned plug-in iteration does—and does not—guarantee.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

What would count as restoring an image?

Suppose a camera records a blurred sign with bright and dark speckles. Removing speckles, undoing blur and inventing a sharp-looking sign are three different operations. Image restoration estimates an underlying image from a degraded observation. The method needs a description of the degradation and some way to prefer plausible solutions when the observation is insufficient.

For denoising, the forward operator may be the identity. Deblurring mixes neighboring pixels. Missing-pixel reconstruction observes a subset, and super-resolution combines degradation with a coarser sampling grid. These tasks share inverse-problem language, but their data steps differ. The denoiser-prior approach explicitly separates the measurement constraint from the image model. CNN denoiser prior, §2

We will implement two kinds of prior. A squared-gradient penalty is a formula whose stationary point we can check. A small residual CNN learns to estimate noise; we can differentiate it and measure its output, but plugging it into an iteration does not automatically give it the same mathematical guarantees. The complete exercise trains all 233 stored CNN parameters and includes an asymmetric blur so that an incorrect adjoint cannot hide behind symmetry.

Before the derivation, predict two things. Must a regularized image always be closer to the clean target than the observation? Must the data residual decrease at every learned-denoiser iteration? Our fixed numerical experiment answers “no” to both, for different reasons.

Actual denoising and deblurring results, with clean-target MSE and the separate after-denoising measurement residual. The Jacobian values describe one independent 4×4 probe.
Actual denoising and deblurring results, with clean-target MSE and the separate after-denoising measurement residual. The Jacobian values describe one independent 4×4 probe.

Measurement, prior and an honest backward pass

Begin with the measurement model

Flatten an image into a vector x when using matrix notation. Let y be the observation, H a known linear degradation and n additive noise:

y=Hx+n,x^=arg⁡min⁡x{12∥Hx−y∥22+λΦ(x)}.y=Hx+n,\qquad \widehat x=\arg\min_x\left\{\frac12\|Hx-y\|_2^2+\lambda\Phi(x)\right\}.

The first term measures disagreement with the observed data; Phi is the prior penalty. Under independent, equal-variance Gaussian noise and a specified prior density, a negative log posterior gives this type of objective after absorbing the noise scale into lambda. A maximum-a-posteriori estimate and a conditional-mean estimate are different decisions; the objective above does not make them interchangeable. The splitting formulation in the cited paper starts from a data term and regularizer. CNN denoiser prior, §2, Eqs. 1–2

For any linear H, differentiating the squared term gives:

∇x12∥Hx−y∥22=HT(Hx−y),⟨Hx,v⟩=⟨x,HTv⟩.\nabla_x\frac12\|Hx-y\|_2^2=H^T(Hx-y),\qquad \langle Hx,v\rangle=\langle x,H^Tv\rangle.

The adjoint redistributes a measurement residual into image coordinates. It is not generally the same blur as the forward operator. An asymmetric kernel is a useful unit test: reusing the forward blur as its own transpose should fail.

An explicit prior and a closed-form solution

Our non-neural baseline uses periodic forward differences D_h and D_w:

Φ(x)=12(∥Dhx∥22+∥Dwx∥22),(HTH+λDTD)x^=HTy,DTD=DhTDh+DwTDw.\Phi(x)=\frac12\big(\|D_hx\|_2^2+\|D_wx\|_2^2\big),\qquad (H^TH+\lambda D^TD)\widehat x=H^Ty, \quad D^TD=D_h^TD_h+D_w^TD_w.

Set the derivative to zero to obtain the normal equation. Penalizing differences discourages rapid intensity changes, including both noise and real edges. This is a quadratic smoothness prior, not total variation: squaring the differences changes how large jumps are penalized.

If H is a circular convolution, the discrete Fourier transform diagonalizes H and the periodic differences. Write the blur transfer function as K and the transform of y as Y. At frequency indices k,l on an h×w image:

qkl=4sin⁡2(πk/h)+4sin⁡2(πl/w),X^kl=K‾klYkl∣Kkl∣2+λqkl.q_{kl}=4\sin^2(\pi k/h)+4\sin^2(\pi l/w),\qquad \widehat X_{kl}=\frac{\overline K_{kl}Y_{kl}}{|K_{kl}|^2+\lambda q_{kl}}.

This is our derivation for the stated boundary model. The factor q is the squared magnitude of the forward-difference symbols. Its zero-frequency value is zero: a gradient penalty cannot determine an unknown constant. If the blur also removes that frequency, the denominator is zero and this prior does not make the solution identifiable. The implementation rejects such a case.

Circular convolution wraps one edge around to the opposite edge. The CNN below uses zero padding instead. Those are two explicitly different boundary choices inside the experiment, not interchangeable ways to implement the same forward model. Real photographs generally require a more suitable boundary treatment.

Learn the noise residual

For denoising, take H=I and let R_theta predict the added noise. Reconstruction subtracts the predicted residual:

y=x+n,Rθ(y)≈n,Dθ(y)=y−Rθ(y),L(θ)=1P∥Rθ(y)−n∥22.y=x+n,\qquad R_\theta(y)\approx n,\qquad D_\theta(y)=y-R_\theta(y),\qquad L(\theta)=\frac1P\|R_\theta(y)-n\|_2^2.

The denoised error is n−R_theta(y), so its squared norm equals the residual error’s squared norm. Their signs differ before squaring. DnCNN uses this noise-residual idea with convolution, batch normalization and ReLU layers. Its fixed-noise configuration has 17 convolutional layers, much larger than our three-layer example. DnCNN, §III, physical pp. 3–4

Our first layer is 3×3 convolution plus ReLU; the second is 3×3 convolution, batch normalization and ReLU; the final 3×3 convolution outputs one noise channel. The hidden width is four. Parameters including all biases and BN affine terms are:

(9 ⁣⋅1⋅4+4)+(9 ⁣⋅4⋅4+4)+(9 ⁣⋅4⋅1+1)+4+4=233.(9\!\cdot1\cdot4+4)+(9\!\cdot4\cdot4+4)+(9\!\cdot4\cdot1+1)+4+4=233.

The pre-BN bias is redundant during training: adding a channelwise constant changes its batch mean by the same amount, which normalization subtracts. Its training gradient is zero apart from numerical roundoff. A stored-parameter count is therefore not a count of independent functional degrees of freedom.

Batch normalization has two different derivatives

For one channel, let M count all batch and spatial entries. During training, calculate population moments and normalize with epsilon=1e−5:

m=1M∑iai,v=1M∑i(ai−m)2,a^i=ai−mv+ϵ,bi=γa^i+β.m=\frac1M\sum_i a_i,\qquad v=\frac1M\sum_i(a_i-m)^2,\qquad \widehat a_i=\frac{a_i-m}{\sqrt{v+\epsilon}},\qquad b_i=\gamma\widehat a_i+\beta.

If g_i is the derivative of the loss with respect to b_i, define t_i=gamma g_i and an overbar as the average over these M entries. Differentiating the mean and variance gives:

∂L∂ai=ti−t‾−a^i ta^‾v+ϵ,∂L∂γ=∑igia^i,∂L∂β=∑igi.\frac{\partial L}{\partial a_i} =\frac{t_i-\overline t-\widehat a_i\,\overline{t\widehat a}}{\sqrt{v+\epsilon}},\qquad \frac{\partial L}{\partial\gamma}=\sum_i g_i\widehat a_i,\qquad \frac{\partial L}{\partial\beta}=\sum_i g_i.

The two subtraction terms carry the dependence through the estimated moments. With fixed inference moments, they disappear from the input derivative because the moments are constants. Changing another image in a training batch can therefore change this image’s output. With fixed inference moments, images are processed independently. See batch normalization for the broader distinction.

The exercise calibrates its final population moments once on training images with newly sampled training noise, after parameter training. It does not average the test batch and does not claim to match a framework’s running-mean convention. The local convolutional receptive field at inference is 7×7; training BN additionally couples the batch and spatial statistics.

The complete backward pass propagates through all three convolutions, both ReLU masks and BN, with overlap accumulation as in backpropagation. For the reconstructed image, remember the identity path:

JD(y)=I−JR(y),∇yL=g−JR(y)Tg.J_D(y)=I-J_R(y),\qquad \nabla_y L=g-J_R(y)^Tg.

Using only the negative residual gradient would omit the direct contribution of y. The code’s Jacobian diagnostic builds rows with output basis vectors and uses this full expression.

Separate the data step from the denoiser

Introduce a second image variable z. A half-quadratic splitting formulation penalizes disagreement between x and z:

Eμ(x,z)=12∥Hx−y∥2+λΦ(z)+μ2∥x−z∥2,μ>0.E_\mu(x,z)=\frac12\|Hx-y\|^2+\lambda\Phi(z)+\frac\mu2\|x-z\|^2,\qquad \mu>0.

For fixed z, the x subproblem is quadratic. Differentiate, collect the x terms and solve:

(HTH+μI)x=HTy+μz,Xkl=K‾klYkl+μZkl∣Kkl∣2+μ.(H^TH+\mu I)x=H^Ty+\mu z,\qquad X_{kl}=\frac{\overline K_{kl}Y_{kl}+\mu Z_{kl}}{|K_{kl}|^2+\mu}.

Unlike the squared-gradient formula, the denominator here contains a strictly positive constant mu. Every frequency has a defined update, even if K vanishes there. This is the exact data step for the stated circular model, not an iterative approximation to that subproblem. CNN denoiser prior, §2, data subproblem

The exact prior step would be:

z=arg⁡min⁡z{12∥z−x∥2+λμΦ(z)},σequivalent=λ/μ.z=\arg\min_z\left\{\frac12\|z-x\|^2+\frac\lambda\mu\Phi(z)\right\},\qquad \sigma_{\rm equivalent}=\sqrt{\lambda/\mu}.

The equivalent noise scale follows by writing a Gaussian denoising likelihood plus Phi and multiplying by sigma squared. The paper uses denoisers within this separation. Our experiment instead inserts one fixed-noise CNN into 12 data/denoising iterations with fixed mu=0.3. It has neither the paper’s denoiser bank nor its noise-level schedule. CNN denoiser prior, §2, denoising subproblem

Do not infer that this arbitrary CNN minimizes the displayed prior subproblem, that one shared Phi exists for it, or that the resulting iteration converges. The existence of an exact data step alone proves none of those claims. The analytic quadratic-prior baseline and the learned plug-in iteration are separate methods.

Work and memory

A circular data step on P pixels costs order P log P using FFTs, with order P working arrays per image/channel; the fixed transfer function can be cached. Convolution costs scale with batch size, image area, kernel area and input/output channels. This small implementation materializes patches, which uses more memory than specialized kernels.

Forming a dense P×P denoiser Jacobian requires P backward passes and quadratic output storage. That is a diagnostic for a tiny probe, not an appropriate routine for a full-resolution image. The program explicitly limits the probe to 64 scalars.

Train, restore, and report the baseline that failed

Save this complete program as image_restoration.py and run python image_restoration.py with NumPy. Recorded execution used Python 3.12.4 and NumPy 1.26.4. It generates 24 training images with seed 41, adds fresh Gaussian noise of standard deviation 0.08 each step using seed 42, and trains for 160 Adam updates. Initialization uses seed 4; learning rate is 0.008, coefficients 0.9/0.999 and epsilon 1e−8. Final BN calibration uses only training images and noise seed 43.

Eight test images use seed 61. A generator seeded 62 first produces denoising noise of standard deviation 0.08 and then deblurring noise of standard deviation 0.02. The blur kernel is asymmetric and sums to one. The quadratic prior weight is 0.02. These are fixed teaching settings, not selected benchmark optima. Ground-truth images are clipped during synthesis; observations and outputs are not clipped.

"""Original tiny residual denoiser and circular inverse-problem solvers.

All 233 CNN parameters differentiated; calibrated population BN inference.
A quadratic-prior solution is explicit. Learned plug-in iterations are a separate
experiment, not a claim that this CNN is a proximal map or converges in general.
"""
import json
import numpy as np

def finite(x,shape=None):
    x=np.asarray(x,dtype=float)
    if not np.isfinite(x).all() or (shape is not None and x.shape!=shape):raise ValueError('Finite matching arrays required')
    return x

def count(n,minimum=1):
    if isinstance(n,(bool,np.bool_)) or not isinstance(n,(int,np.integer)) or not minimum<=n<=4096:raise ValueError('Integer count out of range')
    return int(n)

def convolve(x,w,b):
    x=finite(x);w=finite(w);b=finite(b)
    if x.ndim!=4 or w.ndim!=4 or b.shape!=(w.shape[3],) or x.shape[-1]!=w.shape[2] or not x.size:raise ValueError('NHWC image and HWIO kernel required')
    kh,kw,ci,co=w.shape;n,h,width,_=x.shape;oh=h-kh+1;ow=width-kw+1
    if min(kh,kw,ci,co,oh,ow)<1:raise ValueError('Kernel does not fit input')
    patches=np.stack([x[:,i:i+oh,j:j+ow,:] for i in range(kh) for j in range(kw)],axis=-2)
    result=patches.reshape(-1,kh*kw*ci)@w.reshape(-1,co)+b
    return result.reshape(n,oh,ow,co),(x,w,patches)

def convolve_vjp(g,cache):
    x,w,patches=cache;n,oh,ow=patches.shape[:3];kh,kw,ci,co=w.shape;g=finite(g,(n,oh,ow,co))
    flat=g.reshape(-1,co);dw=(patches.reshape(-1,kh*kw*ci).T@flat).reshape(w.shape);db=flat.sum(axis=0)
    dp=(flat@w.reshape(-1,co).T).reshape(n,oh,ow,kh*kw,ci);dx=np.zeros_like(x)
    for i in range(kh):
        for j in range(kw):dx[:,i:i+oh,j:j+ow,:]+=dp[:,:,:,i*kw+j,:]
    return dx,dw,db

def dataset(number,seed,size=12):
    n=count(number);size=count(size,6)
    if size%2:raise ValueError('Even HR size required')
    rng=np.random.default_rng(seed);yy,xx=np.mgrid[:size,:size]/size;images=[]
    for _ in range(n):
        image=np.full((size,size),.25)
        for j in range(3):
            cx,cy=rng.uniform(.1,.9,2);sx,sy=rng.uniform(.12,.3,2)
            image+=rng.uniform(-.15,.35)*np.exp(-.5*((xx-cx)**2/sx**2+(yy-cy)**2/sy**2))
        image+=rng.uniform(-.05,.05)*xx+rng.uniform(-.05,.05)*yy
        images.append(np.clip(image,0,1))
    return np.array(images)[:,:,:,None]

def metrics(prediction,target):
    prediction=finite(prediction);target=finite(target,prediction.shape)
    if prediction.ndim!=4 or not prediction.size:raise ValueError('Nonempty NHWC paired images required')
    mse=float(np.mean((prediction-target)**2));each=np.mean((prediction-target)**2,axis=(1,2,3))
    with np.errstate(divide='ignore'):
        return {'mse':mse,'psnr_from_global_mse':float(-10*np.log10(mse)),'mean_image_psnr':float(np.mean(-10*np.log10(each)))}

def same_convolution(x,w,b):
    if w.shape[:2]!=(3,3):raise ValueError('This denoiser uses 3x3 kernels')
    return convolve(np.pad(x,((0,0),(1,1),(1,1),(0,0))),w,b)


def same_vjp(g,cache):
    dx,dw,db=convolve_vjp(g,cache);return dx[:,1:-1,1:-1],dw,db


def batch_norm(x,gamma,beta,statistics=None):
    x=finite(x)
    if x.ndim!=4 or not x.size:raise ValueError('Nonempty NHWC activations required')
    gamma=finite(gamma,(x.shape[-1],));beta=finite(beta,gamma.shape)
    mean=x.mean(axis=(0,1,2)) if statistics is None else finite(statistics['mean'],gamma.shape)
    variance=x.var(axis=(0,1,2)) if statistics is None else finite(statistics['variance'],gamma.shape)
    if np.any(variance<0):raise ValueError('Nonnegative variance required')
    inverse=1/np.sqrt(variance+1e-5);normalized=(x-mean)*inverse
    return normalized*gamma+beta,(normalized,inverse,gamma,statistics is None),{'mean':mean,'variance':variance}


def batch_norm_vjp(g,cache):
    normalized,inverse,gamma,training=cache;g=finite(g,normalized.shape);dx=g*gamma;axes=(0,1,2)
    if training:dx-=dx.mean(axis=axes)+normalized*np.mean(dx*normalized,axis=axes)
    return dx*inverse,np.sum(g*normalized,axis=axes),np.sum(g,axis=axes)


def initialize(seed=4):
    rng=np.random.default_rng(seed);h=4
    return {'w1':rng.normal(0,.15,(3,3,1,h)),'b1':np.full(h,.1),'w2':rng.normal(0,.15,(3,3,h,h)),
            'b2':np.zeros(h),'gamma':np.ones(h),'beta':np.zeros(h),'w3':rng.normal(0,.015,(3,3,h,1)),'b3':np.zeros(1)}


def forward(y,p,statistics=None):
    if set(p)!={'w1','b1','w2','b2','gamma','beta','w3','b3'}:raise ValueError('All CNN parameter arrays required')
    y=finite(y);a,c1=same_convolution(y,p['w1'],p['b1']);b,c2=same_convolution(np.maximum(a,0),p['w2'],p['b2'])
    normalized,bnc,stats=batch_norm(b,p['gamma'],p['beta'],statistics);residual,c3=same_convolution(np.maximum(normalized,0),p['w3'],p['b3'])
    return residual,(a,normalized,c1,c2,c3,bnc),stats


def backward(g,cache):
    a,normalized,c1,c2,c3,bnc=cache;dn,w3,b3=same_vjp(g,c3);db,gamma,beta=batch_norm_vjp(dn*(normalized>0),bnc)
    da,w2,b2=same_vjp(db,c2);dy,w1,b1=same_vjp(da*(a>0),c1)
    return {'w1':w1,'b1':b1,'w2':w2,'b2':b2,'gamma':gamma,'beta':beta,'w3':w3,'b3':b3},dy


def denoise(y,p,statistics):
    return y-forward(y,p,statistics)[0]


def train(steps=160,sigma=.08):
    steps=count(steps)
    if not np.isfinite(sigma) or sigma<=0:raise ValueError('Positive finite noise standard deviation required')
    clean=dataset(24,41);rng=np.random.default_rng(42);p=initialize();first={k:np.zeros_like(v) for k,v in p.items()};second={k:np.zeros_like(v) for k,v in p.items()};history=[]
    for step in range(1,steps+1):
        noise=rng.normal(0,sigma,clean.shape);noisy=clean+noise;prediction,cache,_=forward(noisy,p);error=prediction-noise
        history.append(float(np.mean(error**2)));gradient,_=backward(2*error/error.size,cache)
        for key in p:
            first[key]=.9*first[key]+.1*gradient[key];second[key]=.999*second[key]+.001*gradient[key]**2
            p[key]-=.008*(first[key]/(1-.9**step))/(np.sqrt(second[key]/(1-.999**step))+1e-8)
    # Explicit post-training population calibration, using training images only.
    calibration=clean+np.random.default_rng(43).normal(0,sigma,clean.shape);_,_,statistics=forward(calibration,p)
    return p,statistics,clean,history


def transfer(kernel,shape):
    kernel=finite(kernel)
    if kernel.ndim!=2 or min(kernel.shape)<1 or any(n%2==0 for n in kernel.shape):raise ValueError('Odd nonempty 2D kernel required')
    if len(shape)!=2 or any(not isinstance(n,(int,np.integer)) or isinstance(n,(bool,np.bool_)) or n<1 for n in shape):raise ValueError('Two positive image dimensions required')
    if any(k>n for k,n in zip(kernel.shape,shape)):raise ValueError('Kernel must fit image')
    canvas=np.zeros(shape);canvas[:kernel.shape[0],:kernel.shape[1]]=kernel
    canvas=np.roll(canvas,(-(kernel.shape[0]//2),-(kernel.shape[1]//2)),axis=(0,1))
    return np.fft.fft2(canvas)


def blur(x,kernel,adjoint=False):
    x=finite(x)
    if x.ndim!=4 or not x.size:raise ValueError('Nonempty NHWC image required')
    h=transfer(kernel,x.shape[1:3]);h=h.conj() if adjoint else h
    return np.fft.ifft2(np.fft.fft2(x,axes=(1,2))*h[None,:,:,None],axes=(1,2)).real


def data_step(y,z,kernel,mu):
    y=finite(y);z=finite(z,y.shape)
    if y.ndim!=4 or not y.size or not np.isfinite(mu) or mu<=0:raise ValueError('Images and positive penalty required')
    h=transfer(kernel,y.shape[1:3]);fy=np.fft.fft2(y,axes=(1,2));fz=np.fft.fft2(z,axes=(1,2))
    solution=(h.conj()[None,:,:,None]*fy+mu*fz)/(np.abs(h)[None,:,:,None]**2+mu)
    return np.fft.ifft2(solution,axes=(1,2)).real


def laplacian_spectrum(shape):
    h,w=shape
    return 4*np.sin(np.pi*np.arange(h)/h)[:,None]**2+4*np.sin(np.pi*np.arange(w)/w)[None,:]**2


def quadratic_restore(y,kernel,weight=.02):
    y=finite(y)
    if y.ndim!=4 or not y.size or not np.isfinite(weight) or weight<=0:raise ValueError('Image and positive prior weight required')
    h=transfer(kernel,y.shape[1:3]);denom=np.abs(h)**2+weight*laplacian_spectrum(y.shape[1:3])
    if denom.min()<1e-14:raise ValueError('Unidentifiable frequency under this prior')
    solution=h.conj()[None,:,:,None]*np.fft.fft2(y,axes=(1,2))/denom[None,:,:,None]
    return np.fft.ifft2(solution,axes=(1,2)).real


def learned_restore(y,kernel,p,statistics,steps=12,mu=.3):
    steps=count(steps);z=finite(y).copy();history=[]
    for _ in range(steps):
        x=data_step(y,z,kernel,mu);z=denoise(x,p,statistics)
        history.append(float(np.mean((blur(z,kernel)-y)**2)))
    return z,history



def denoiser_jacobian(y,p,statistics):
    y=finite(y)
    if y.ndim!=4 or y.shape[0]!=1 or not y.size or y.size>64:raise ValueError('One small probe with at most 64 scalars required')
    _,cache,_=forward(y,p,statistics);jacobian=np.empty((y.size,y.size))
    for i in range(y.size):
        basis=np.zeros_like(y);basis.ravel()[i]=1
        _,dr=backward(basis,cache);jacobian[i]=basis.ravel()-dr.ravel()
    return jacobian


def demo():
    p,statistics,clean,history=train();test=dataset(8,61);rng=np.random.default_rng(62);noisy=test+rng.normal(0,.08,test.shape)
    prediction=denoise(noisy,p,statistics);kernel=np.array([[0.,.05,.05],[.1,.35,.1],[.05,.1,.2]])
    degraded=blur(test,kernel)+rng.normal(0,.02,test.shape);ridge=quadratic_restore(degraded,kernel);restored,trace=learned_restore(degraded,kernel,p,statistics)
    jacobian=denoiser_jacobian(noisy[:1,:4,:4],p,statistics)
    return {'parameters':sum(v.size for v in p.values()),'train_images':24,'test_images':8,'pixels_per_image':144,
            'training_noise_sigma':.08,'deblurring_noise_sigma':.02,'first_batch_residual_mse':history[0],'last_batch_residual_mse':history[-1],
            'noisy':metrics(noisy,test),'denoised':metrics(prediction,test),'blurred_noisy':metrics(degraded,test),
            'quadratic_prior':metrics(ridge,test),'learned_plugin':metrics(restored,test),'plugin_data_residual_first_last':[trace[0],trace[-1]],'probe_jacobian_asymmetry':float(np.max(np.abs(jacobian-jacobian.T))),'probe_jacobian_operator_norm':float(np.linalg.norm(jacobian,2))}


if __name__=='__main__':print(json.dumps(demo(),indent=2))

The two tasks use the same clean test images but different observations; compare methods within each task:

Task and methodGlobal MSE against clean targetPSNR from global MSE
Denoising: noisy observation0.005891800722.2975 dB
Denoising: residual CNN0.001117710529.5167 dB
Deblurring: blurred noisy observation0.000881824330.5462 dB
Deblurring: quadratic prior0.000983971730.0702 dB
Deblurring: learned plug-in0.000614899732.1120 dB

The fixed quadratic baseline worsens clean-image MSE here. It solves its chosen objective, not an oracle objective that knows the clean answer. The learned plug-in improves this image metric, yet its first and last data-residual MSE values are approximately 0.0005699576 and 0.0005833646. Image error and measurement residual are different quantities, and this trace does not decrease monotonically from beginning to end.

The first and last pre-update training batch losses are approximately 0.0085278371 and 0.0011676608. Each step uses fresh noise, so those values are not evaluations on one fixed noisy batch. They must not be presented as a deterministic fixed-data convergence curve.

For a 4×4 probe cropped from the first noisy test image and then treated as a separate zero-padded image, the dense denoiser Jacobian has maximum entrywise asymmetry about 0.283120 and spectral norm about 1.075548. The norm describes local sensitivity at that probe, where the derivative is defined; it is not a global Lipschitz bound. The matrix is not the full 12×12 image’s Jacobian. These observations offer no general convergence guarantee.

The numerical checks include all 233 parameter derivatives, the full reconstructed-input gradient, training/fixed-statistics BN, an independent circular-convolution sum, adjoint identities, a dense 16×16 normal-equation comparison and quadratic-prior stationarity. They also check training-only calibration and the negative results above. The implementation is original teaching code, not the original DnCNN training system or a real-image benchmark reproduction.

A good denoiser is not a complete inverse-problem specification

Our noise is additive, independent and Gaussian with one training standard deviation. Real acquisition can make noise depend on signal intensity, mix channels or correlate neighboring pixels. A model trained for the stated synthetic distribution does not automatically handle those changes. Unknown blur adds an estimation problem that our known-kernel solver does not solve.

The CNN uses zero padding while the deblurring operator uses circular boundaries. Edge artifacts or a shift in the kernel center can dominate a small image. The code centers the odd-sized kernel before taking its FFT and uses the complex conjugate for the adjoint. A kernel that looks roughly right but is shifted by one pixel defines a different H.

Batch normalization is part of the learned map, including its calibration rule. Updating statistics on held-out images changes the evaluation procedure and can make output depend on the composition of a test batch. DnCNN’s discussion motivates combining BN with residual learning, but its proposed explanation is not a universal causal law for every architecture. DnCNN, §III

For a deployment-oriented comparison, retain the unprocessed observation as a baseline, evaluate the actual degradation and boundary model, and choose prior weights on separate validation data. If the task involves interpreting restored text or structure, inspect the observation and uncertainty as well as the attractive output. More natural-looking images and more faithful measurements need separate evidence.

Four ways to catch a plausible mistake

  1. Understanding. A model predicts positive additive noise R(y). Should its reconstruction be y+R(y) or y−R(y)?

    Answer: Subtract it. From y=x+n and R(y)≈n, the estimate is y−R(y). A graph with an additive skip can still represent restoration if its branch learns negative noise; inspect the training target and sign convention before assigning meaning to a tensor.

  2. Calculation. With H=I, mu=3, scalar observation y=0.2 and prior-step value z=0.6, what is the exact data step?

    Answer: The normal equation is (1+3)x=0.2+3×0.6, so x=0.5. Larger mu pulls this subproblem toward z. The operation is a compromise with the current z, not an unconditional replacement of the observation by the denoiser.

  3. Boundary and identifiability. Why can a squared-gradient prior fail to recover the mean intensity when the blur removes the zero frequency?

    Answer: Constant images have zero differences, so q at zero frequency is zero. If K is also zero there, neither the data term nor the prior constrains that component; the Fourier denominator is zero. Add justified information about the mean or use a different model. Dividing by an arbitrary epsilon hides the ambiguity rather than identifying the true mean.

  4. Transfer. The learned plug-in has better clean-target MSE but a larger final data residual than its first iteration. Does this invalidate the exact FFT data-step derivation?

    Answer: No. That derivation holds for x with the current z fixed. The subsequent learned denoising step changes the image, and no common objective or monotone residual was established for that step. Report both metrics, inspect the trace and avoid turning a local subproblem guarantee into a guarantee about the whole iteration.

Separate the paper, the implementation and the exercise

DnCNN’s first arXiv submission is dated 2016-08-13. We read extracted physical pages 3–4 of v1 for the residual definition, architecture and padding; this is not a full-paper or visual-figure review. The later journal reference is a different publication record. Official submission history

For the CNN-denoiser-prior paper, extracted physical pages 2–3 establish the splitting equations and equivalent denoising scale. The explicit Fourier smoothness solver and all gradients in this exercise are derived for our stated operators. No arbitrary-denoiser convergence theorem is being attributed to the paper.

We also inspected the original authors’ DnCNN repository at commit e93b27812d3ff523a3a79d19e5e50d233d7a8d0a, lines 1–105 of the DagNN initialization file. Its graph adds the branch to the input. The training-label construction was not inspected, so that observation alone does not identify the branch as the positive noise residual defined in the paper. No upstream code was copied or executed, and a reusable license was not confirmed within the inspected scope. Pinned initialization

Continue with batch normalization for train/inference behavior, the Fourier transform for diagonalization, and super-resolution for sampling ambiguity and metric aggregation.

Make a prediction, then check

An FFT data step is exact. Does adding an arbitrary learned denoiser guarantee convergence of the whole iteration?

Choose one answer

Learning objectives

  • Derive an adjoint, quadratic smoothness solution and exact circular data step.
  • Differentiate all 233 stored residual-CNN parameters and distinguish BN training from fixed-statistics inference.
  • Explain why an inserted denoiser need not solve a shared prior objective.
  • Interpret failed baselines, nonmonotone data residuals and a local Jacobian without claiming global guarantees.

Prerequisites & connections

Explore related knowledge →

References

  1. Beyond a Gaussian Denoiser: Residual Learning of Deep CNN for Image Denoising (v1)
    Kai Zhang; Wangmeng Zuo; Yunjin Chen; Deyu Meng; Lei Zhang · 2016
  2. Learning Deep CNN Denoiser Prior for Image Restoration (v1)
    Kai Zhang; Wangmeng Zuo; Shuhang Gu; Lei Zhang · 2017
  3. DnCNN arXiv submission history
    arXiv; Kai Zhang et al. · 2016
  4. DnCNN DagNN initialization at e93b27812
    cszn/DnCNN contributors · 2021

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-08 · Codex single-AI-author technical check: scoped DnCNN and denoiser-prior methods plus pinned initialization; 12 paired equations, all 233 stored parameter derivatives, BN and identity-path gradients, circular normal equations, four explained bilingual exercises, negative results and actual figure data. Final production browser checks recorded separately. Not human peer review or a benchmark reproduction.

  • Compared both manuscripts: forward/adjoint, quadratic smoothness and identifiability, residual sign and full identity gradient, population/fixed-statistics BN, HQS normal equations and equivalent noise scale, all four explained exercises.
  • All 233 stored parameter and input derivatives, BN and residual identity, asymmetric blur/adjoint, dense normal equations, prior stationarity and local Jacobian checked in 15 numerical tests; production suite embeds them and executes MDX, not preflight imports.
  • Preserved failed quadratic baseline, nonmonotone learned-plugin data residual, and separate 4x4 zero-padded Jacobian probe. 24/8 synthetic images, 160 updates, fixed-noise calibrated CNN; no shared-prior or general convergence claim.
  • Four original SVGs bind actual model outputs and raw data. Isolated two-language, three-width, four-font checks passed; complete article/browser acceptance is recorded separately. Single-AI-author technical review, not human or independent peer review. Source scopes are explicit and no upstream code was copied/executed.

Source locations checked:

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.