The paper aims to solve "inverse" problems in image processing like denoising, super-resolution, inpainting, etc. using image priors from handcrafted neural networks and without data.
This paper uses the structure of ConvNets to learn the inverse function. The only information to reconstruct the output image is in the degraded input image, and the handcrafted structure of the network used in the reconstruction. This is remarkable because no aspect of the network is learnt from data.
Consider a "good image" and a degraded version of the image . We only have and wish to recover . We do that using Bayes Rule:
The first term is the likelihood of the corrupted image given the good image, basically the degradation model. The second term is the prior distribution over good images. So a candidate is good if the likelihood is high, and the prior is also high.
Priors can be explicit or implicit. Some examples of priors over "good images" are:
- Good images should be smooth (Ising/Potts prior).
- Binary/Categorical signals
- Good images should have small Total Variation https://en.wikipedia.org/wiki/Total_variation_denoising.
- Continuous signals
- Good images should be from a particular distribution defined by a dataset of images.
- Good images should have more low-frequency components than high-frequency ones (Gaussian smoothing).
To find a candidate we need to maximize the log-Posterior. Doing so gives us an optimization problem:
Different priors will lead to different choices of . Let's call this the regularizer function.
Explicit regularizers (like TV or Gaussian) will have a definite form of However, if the image is generated from some mechanism, then the prior term becomes implicit. One can also add explicit regularizers to satisfy more prior terms, its upto the end-user to specify.
An example - Explicit Priors in denoising
An example of explicit priors can be shown in denoising. In denoising, the good signal is corrupted by the following process
The likelihood therefore becomes:
Simply minimizing will give us which is not a good solution for denoising. Therefore, adding priors may be helpful. Consider the following regularizer:
which promotes smoothness in space. Minimizing will give a smoother solution for . Here is the output for a sinusoidal wave corrupted by noise.
Images generated from ConvNets have constraints. ConvNets capture the local and translation-invariant nature of convolutions, and the usage of a sequence of such operators captures the relationship of pixel neighborhoods at multiple scales. These are the priors built into the network that generates the image .
Given a ConvNet with parameters having some implicit prior, we solve the following problem:
where is a random, fixed code vector. The local minimizer of this problem is obtained using an optimizer such as gradient descent, starting from a random initialization of parameters . Since there is no data to tune the parameters, the prior comes only from the structure of the ConvNets.
How are neural networks a prior?
After seeing the power of neural networks to solve complex problems, it seems that neural nets might fit to any image, including noise. However, the choice of network architecture has a major effect on how the solution space is searched.
In particular, "bad" solutions are resisted by the network and it descends much more quickly towards naturally-looking images. For example, these are the loss curves in a reconstruction problem:
We see that neural networks have a higher impedance to noise. In the previous case (reconstruction), the optimization is simply .
In the limit, the ConvNet can fit noise as well, but it doesn't so very reluctantly. The parameterization offers high impedance to noise and low impedance to signal. However, to prevent noise from overfitting into the ConvNet, early stopping has to be used.
Here are examples of how that would work in the image-space:
The ground truth satisfies the energy equation, and adding a conventional prior may tweak the energy so that the candidate is close to the ground truth. DIP has a similar effect, but it tweks the optimization trajectory via re-parameterization.
Here the ground truth image doesn't satisfy the energy equation. If run for long enough, DIP will obtain a near-zero cost far from the ground truth. However, the optimization path will pass close to the ground truth, and early stopping can help recover a good solution.
How to "sample" from this prior
Although the prior is implicit, we can still draw samples in a loose sense. To do that, take different initializations for the same code vector and same architecture.
For example, this figure shows the outputs for two different initializations. Each column is a different architecture. Resulting images are far from independent noise and correspond to stochastic processes. There is a clear self-similarity in patches of the image across scales.
Denoising and general reconstruction
Since the parameterization presents high impedance to noise than signal, denoising is a natural application for this work.
The method also works for blind denoising where the noise model is not known. They simply use the loss
If the noise model is known, the loss function can be changed, otherwise one can use the default L2 loss. This allows to use the method in a plug-n-play fashion.
- Overly wide skip connections lead to weak priors and fitting happens too fast.
- Lack of skip connections leads to slow fitting and prior that is too strong.
Stark differences in architecture lead to varying results.
The input is and output is a downsampled image. To solve the inverse problem, the data term is:
where is the down-sampling operator. Super-resolution is ill-posed because there are infinitely many solutions that give the same downsampled image. A regularizer is needed to select one of the solutions.
The data term here is:
Where is the binary mask of known pixels, and is the Hadamard product. Data prior is required here because the unknown region can be filled arbitrarily without affecting the data term.
For random masks with high dropout, DIP can fill the regions pretty well. It's not supposed to work well for heavily-semantic inpainting (since there is no prior from a dataset) but it still works decent.
The pre-image is a method to study invariances of a lossy function such as a deep network. Let be the first several layers of a neural network. The pre-image is the set:
This is the set of images that result in the same representation in the neural network . However, directly optimizing this can result in non-natural images with artifacts. This has been done using priors like TV prior or using priors from a dataset. Priors from dataset are often found to regress towards the mean. Therefore, learnable discriminator and perceptual losses are used in such works. That is not required in DIP since there is only one image to reconstruct.
Similar to the pre-image method, but here the image should maximize the activation of the neural network.
where is the mask of a chosen neuron. This can be done at any level, even the final layer, which can give an idea of what images the neural network "thinks of" when it is associated with some class.
Given a target image we use the denoising formulation to obtain a coarse image . The fine details are computed as
and the enhanced image is calculated as
Flash and no-flash image reconstruction [Qualitative]
No-flash images usually have higher noise than flash, but one might be interested in having noise levels of the flash image with style of the non-flash image. DIP can be used to generate such an image, and instead of using a random code vector, one can use the flash image as input.
- Mostly used hourglass-based encoder-decoder architecture.
- Use LeakyReLU as a non-linearity.
- Downsampling doesn't matter.
- In upsampling, transposed convolutions do worse in general than bilinear or nearest-neighbour sampling.
- is filled with
- uniform noise
- meshgrid - works better with large hole inpainting
More hyperparameters are in the paper.