balthazarneveu / blind-deblurring-from-synthetic-data

MVA ENS Paris Saclay - Image restoration project on deblurring learnt on deadleaves
3 stars 0 forks source link

Blind deblurring from synthetic data

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 :


Setup

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

Training

Supported tasks
Supported network architectures
Supported dataset
Synthetic data generation

Generate deadleaves: python scripts/save_deadleaves.py -n deadleaves_primitives_div2k_512

Local training

Download image test datasets hosted on Kaggle

Kodak | Gopro

Remote training

: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.

Monitoring and tracking

Available on Weights and Biases

Metrics

Live inference

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/*"

Metrics and batched inference

Pretrained models

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.