SimDeblur
SimDeblur (Simple Deblurring) is an open source framework for image and video deblurring toolbox 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 or other restoration algorithms.
Major features
- 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
New Features
[2021/3/31] support DVD, GoPro and REDS video deblurring datasets. [2021/3/21] first release.
Surpported Methods and Benchmarks
-
Single Image Deblurring
-
Video Deblurring
-
Benchmarks
Dependencies and Installation
- 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
Usage
1 Start with trainer
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
2 Build each module
The SimDeblur also provides you to build each module. build the 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 the 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.
Dataset Description
Click here for more information.
Acknowledgment
[1] facebookresearch. detectron2. https://github.com/facebookresearch/detectron2
[2] subeeshvasu. Awesome-Deblurring. https://github.com/subeeshvasu/Awesome-Deblurring
Citations
If SimDeblur helps your research or work, please consider citing SimDeblur.
@misc{cao2021simdeblur,
author = {Mingdeng Cao},
title = {SimDeblur},
howpublished = {\url{https://github.com/ljzycmd/SimDeblur}},
year = {2021}
}
If you have any question, please contact me at mingdengcao AT gmail.com
.