Giter Site home page Giter Site logo

hejingwenhejingwen / adafm Goto Github PK

View Code? Open in Web Editor NEW
185.0 5.0 21.0 7.55 MB

CVPR2019 (oral) Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers (AdaFM). PyTorch implementation

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

Python 93.40% MATLAB 6.60%
image-restoration pytorch super-resolution adafm denoising cvpr2019-oral low-level-vision cvpr2019

adafm's Introduction

Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers paper, supplementary file

By Jingwen He, Chao Dong, and Yu Qiao

class AdaptiveFM(nn.Module):
    def __init__(self, in_channel, kernel_size):
        super(AdaptiveFM, self).__init__()
        padding = (kernel_size - 1) // 2
        self.transformer = nn.Conv2d(in_channel, in_channel, kernel_size, padding=padding, groups=in_channel)

    def forward(self, x):
        return self.transformer(x) + x

BibTex

@InProceedings{He_2019_CVPR,
author = {He, Jingwen and Dong, Chao and Qiao, Yu},
title = {Modulating Image Restoration With Continual Levels via Adaptive Feature Modification Layers},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

Dependencies

Pretrained models

We provide a pretrained model for AdaFM-Net (experiments/pretrained_models) that deals with denoising from σ15 to σ75. Please run the following commands directly:

cd codes
python interpolate.py -opt options/test/test.json

The results can be found in the newly created directory AdaFM/results The noise level of the input image is σ45, and you are supposed to obtain similar interpolated results as follows:

Codes

The overall code framework mainly consists of four parts - Config, Data, Model and Network. We also provides some useful scripts. Please run all the following commands in “codes” directory.

How to Test

basic model and AdaFM-Net

  1. Modify the configuration file options/test/test.json (please refer to options for instructions.)
  2. Run command:
python test.py -opt options/test/test.json

modulation testing

  1. Modify the configuration file options/test/test.json
  2. Run command:
python interpolate.py -opt options/test/test.json

or:

  1. Use scripts/net_interp.py to obtain the interpolated network.
  2. Modify the configuration file options/test/test.json and run command: python test.py -opt options/test/test.json

How to Train

basic model

  1. Prepare datasets, usually the DIV2K dataset. More details are in codes/data.
  2. Modify the configuration file options/train/train_basic.json (please refer to options for instructions.)
  3. Run command:
python train.py -opt options/train/train_basic.json

AdaFM-Net

  1. Prepare datasets, usually the DIV2K dataset.
  2. Modify the configuration file options/train/train_adafm.json
  3. Run command:
python train.py -opt options/train/train_adafm.json

Acknowledgement

  • This code borrows heavily from BasicSR.

adafm's People

Contributors

hejingwenhejingwen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

adafm's Issues

how to modify basic.json to train a SRx4 model?

According to your original "basic.json" file ,if i have a LR dataset with 120120 pixels images,and a HR dataset with 480480 pixels images; I need to modify the "crop_size" parameter from 0 to 4; but i find this is wrong ; i can't get any message from feeddata with same size 96*96 ; so how can i make it right?
image
image

ValueError: operands could not be broadcast together with shapes

There are some problem on the subtraction of two images. how can I avoid it?
mse = np.mean((img1 - img2)**2)
ValueError: operands could not be broadcast together with shapes (330,502,3) (1348,2032,3)
It's basically in this position: "util.py", line 111

Why got 'out of memory'?

I just ran 'python interpolate.py -opt options/test/test.json' without other operations.
My configuration is 2080ti.

Could you please upload the supplemental material?

Hi, you have done a great job!
Could you please share the supplemental material?
It is highly apprepriated if you can also share the PSNR distances of Modulation Testing (Sec. 4.3) on denoising and super resolution tasks. The performances look really good on the DeJEPG task.

why transformer(x)+x?

Hi,i have one doubt about the paper and the corresponding code. in the paper ,fmid = f15 + lambda(g - I) * f15; but I think the code corresponds fmid = f15 + lambda*g * f15 ?I cannot fully understanding this .

Filter visualization

Filter visualization 是怎么实现的,论文中现实的是卷积核吗,大小为多少

Is this a typo in your paper?

image
The formulation in sec.3.3Comparison with BN layer,
where µ, σ are the mean and standard deviation of an input batch, γ, β are affine parameters.

Should it be sigma rather than gamma ?
Thanks~

interpolate_stride=lamda?

Excuse me.During the test, the lamda parameter in the paper is interpolate_stride in the code? Why do I get the same result by adjusting from 0 to 1?

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.