MVA project 2024 on image restoration
In the paper Synthetic images as a regularity prior for image restoration neural networks by Raphaël Achddou, Yann Gousseau, Saïd Ladjal, it was shown that a deep neural network can be trained for denoising solely from synthetic dead leave images and does perform relatively well on natural images.
We propose to explore several tracks:
We first validated that NAFNet trained on deadleaves performed well on the blind denoising task. Below you can see that it also performs correctly on natural images, although the performances are not as good as a network purely trained on natural images.
Qualitative results at SNR in = 20dB | Quantitative results |
---|---|
Finally, when applying the deadleaves training to the blind deblurring problem, one of the advantage we have notticed is that the network always tries to deblur even when the level of blur is high. On the contrary, when trained on natural images, the NAFNEt does not work so well when the blur level is too big. | Blind deblurring results |
---|---|
Deblurring result for different amount of blur, using Nafnet trained on Div2K or deadleaves. From left to right column: ”small”, ”mild” and ”big” blur kernels to degrade the input. Top row: input image. Middle row: output of NafNet trained on deadleaves. Bottom row: output of NafNet trained on Div2K. | |
Conclusion :
git clone https://github.com/balthazarneveu/blind-deblurring-from-synthetic-data.git
cd blind-deblurring-from-synthetic-data
pip install -e .
pip install interactive-pipe
pip install batch-processing
Generate deadleaves: python scripts/save_deadleaves.py -n deadleaves_primitives_div2k_512
python scripts/train.py -e -1 -nowb
python scripts/train.py -e 1000
:key: After setting up your kaggle credentials (scripts/__kaggle_login.py
as explained here)
python scripts/remote_training.py -e 1000 -u username -p
For remote training, datasets will be automatically available under Kaggle.
Available on Weights and Biases
Compare several models with a live inference
python scripts/interactive_inference_synthetic.py -e 1000 1001
python scripts/interactive_inference_natural.py -e 1004 2000 -i "__kodak_dataset/*"
-n 5
python scripts/infer.py -e 1004 2000 -o __inference -t metrics --size "512,512 256,256 128,128" --std-dev "1,1 5,5 10,10 20,20 30,30 40,40 50,50 80,80" -n 5
Please refer to check how to aggregate results afterwards metrics_analyzis.ipynb.
Infer with deblur
python scripts/infer.py -e 5000 -o __inference/deblur -t metrics --size "512,512" --std-dev "0,0" -n 2 --traces all --dataset div2k -b
It is even possible to freeze blur kernel indices --blur-index 8 12 17
in order to get the metric with a fixed amount of blur.