SimDeblur (Simple Deblurring) is an open source framework for image and video deblurring based on PyTorch, which contains most deep-learning based state-of-the-art deblurring algorithms. It is easy to implement your own image or video deblurring and restoration algorithms. To the best of our knowledge, this is the first general framework for image/video delburring.
- Modular Design
The toolbox decomposes the deblurring framework into different components and one can easily construct a customized restoration framework by combining different modules.
- State of the art
The toolbox contains most deep-learning based state-of-the-art deblurring algorithms, including MSCNN, SRN, DeblurGAN, EDVR, etc.
- Distributed Training
[2021/4/7] Provide some project demos implemented under SimDeblur: SRN and MSCNN.
[2021/3/31] Support DVD, GoPro and REDS video deblurring datasets.
[2021/3/21] First release.
We will gradually release the checkpoints of each model in checkpoints.md.
-
Single Image Deblurring
-
Video Deblurring
-
Benchmarks
- Python 3 (Conda is recommended)
- Pytorch 1.5.1 (with GPU)
- CUDA 10.2+
- Clone the repositry or download the zip file
git clone https://github.com/ljzycmd/SimDeblur.git
- Install SimDeblur
# create a pytorch env conda create -n simdeblur python=3.7 conda activate simdeblur # install the packages cd SimDeblur bash Install.sh
You can open the Colab Notebook to learn about basic usage and see the deblurring performance.
You can construct a simple training process use the default trainer like following:
from simdeblur.config import build_config, merge_args
from simdeblur.engine.parse_arguments import parse_arguments
from simdeblur.engine.trainer import Trainer
args = parse_arguments()
cfg = build_config(args.config_file)
cfg = merge_args(cfg, args)
cfg.args = args
trainer = Trainer(cfg)
trainer.train()
Then start training with single GPU:
CUDA_VISIBLE_DEVICES=0 bash ./tools/train.sh ./config/dbn/dbn_dvd.yaml 1
multi GPU training:
CUDA_VISIBLE_DEVICES=0,1,2,3 bash ./tools/train.sh ./config/dbn/dbn_dvd.yaml 4
The SimDeblur also provides you to build each module.
Build a dataset:
from easydict import EasyDict as edict
from simdeblur.dataset import build_dataset
dataset = build_dataset(edict({
"name": "DVD",
"mode": "train",
"sampling": "n_c",
"overlapping": True,
"interval": 1,
"root_gt": "./dataset/DVD/quantitative_datasets",
"num_frames": 5,
"augmentation": {
"RandomCrop": {
"size": [256, 256] },
"RandomHorizontalFlip": {
"p": 0.5 },
"RandomVerticalFlip": {
"p": 0.5 },
"RandomRotation90": {
"p": 0.5 },
}
}))
print(dataset[0])
Build a model:
from simdeblur.model import build_backbone
model = build_backbone({
"name": "DBN",
"num_frames": 5,
"in_channels": 3,
"inner_channels": 64
})
x = torch.randn(1, 5, 3, 256, 256)
out = model(x)
Build the loss:
from simdeblur.model import build_loss
criterion = build_loss({
"name": "MSELoss",
})
x = torch.randn(2, 3, 256, 256)
y = torch.randn(2, 3, 256, 256)
print(criterion(x, y))
And the optimizer and lr_scheduler also can be created by "build_optimizer" and "build_lr_scheduler" etc.
Click here for more information.
[1] facebookresearch. detectron2. https://github.com/facebookresearch/detectron2
[2] subeeshvasu. Awesome-Deblurring. https://github.com/subeeshvasu/Awesome-Deblurring
If SimDeblur helps your research or work, please consider citing SimDeblur.
@misc{cao2021simdeblur,
author = {Mingdeng Cao},
title = {SimDeblur: A Simple Framwork for Image and Video Deblurring},
howpublished = {\url{https://github.com/ljzycmd/SimDeblur}},
year = {2021}
}
If you have any question, please open an new issue or contact me at mingdengcao AT gmail.com
.