Coder Social home page Coder Social logo

jkhu29 / deblurring-by-realistic-blurring Goto Github PK

View Code? Open in Web Editor NEW
24.0 1.0 2.0 2.88 MB

A PyTorch implementation of the "Deblurring by Realistic Blurring", unofficially

Home Page: https://arxiv.org/abs/2004.01860

License: MIT License

Python 98.75% Shell 1.25%
deblur wgan

deblurring-by-realistic-blurring's Introduction

Deblurring by Realistic Blurring

article

two GANs are used, one for blurring the image(BGAN) and one for deblurring the image (DBGAN), with the former serving as a priori for the latter.

processes:

  1. sharp --> bgan --> real blur
  2. real blur --> dbgan --> sharp(fake)

losses:relativistic blur loss

relativistic blur loss

the general loss is mainly to ensure that the GANs has the following effects:

  1. the probability that the discriminator considers img to be the real category tends to be infinitely close to 1
  2. the probability that the discriminator considers img to be the fake category tends to be infinitely close to 1

relativistic blur loss is to make p(fake_d) == p(real_d)

Data

please see this part in official implementation

but they do not have training script, that's why I write these code.

Model

bgan_and_dbgan

BGAN:sharp --> blur

GBGAN:blur --> sharp, like DeblurGAN

BGAN

  1. gaussian noise concat
  2. Conv2d --> 9ResBlock --> 2Conv2d (maybe we could use less resblock)
  3. ResBlock: 5Conv2d --> 4LeakyReLU (maybe we could use less Conv2d)
  4. long res

GAN_D: vgg19, pretrained (without BN)

Because the data set is not aligned, the cyclegan idea is used

DBGAN

Basically the same as BGAN

  1. without BN (why not IN)
  2. 16个ResBlock (also, i don't think need so many resblocks)

Result

原图 模糊后 去模糊后

Usage

use tfrecord in pytorch

you can also see .h5 made in Chinese README

in ./dataset_make, run

python dataset_make.py --mode train_blur
python dataset_make.py --mode train_deblur 

then sh train_small.sh

TODOs

  • format code
  • amp in branch: amp
  • visdom

Citation

@inproceedings{zhang2020deblurring,
  title={Deblurring by realistic blurring},
  author={Zhang, Kaihao and Luo, Wenhan and Zhong, Yiran and Ma, Lin and Stenger, Bjorn and Liu, Wei and Li, Hongdong},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={2737--2746},
  year={2020}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.