Code Monkey home page Code Monkey logo

restormer's Introduction

Restormer

A PyTorch implementation of Restormer based on CVPR 2022 paper Restormer: Efficient Transformer for High-Resolution Image Restoration.

Network Architecture

Requirements

conda install pytorch=1.10.2 torchvision cudatoolkit -c pytorch

Dataset

Rain100L and Rain100H are used, download these datasets and make sure the directory like this:

|-- data     
    |-- rain100L
        |-- train
            |-- rain
                norain-1.png
                ...
            `-- norain
                norain-1.png
                ...
        `-- test                                                        
    |-- rain100H
        same as rain100L

Usage

You can easily train and test the model by running the script below. If you want to try other options, please refer to utils.py.

Train Model

python main.py --data_name rain100L --seed 0

Test Model

python main.py --data_name rain100H --model_file result/rain100H.pth

Benchmarks

The models are trained on one NVIDIA RTX A6000 GPU (48G). num_iter is 30,000, seed is 1 and milestone is [9200, 15600, 20400, 24000, 27600], the other hyper-parameters are the default values.

Method Rain100L Rain100H Download
PSNR SSIM PSNR SSIM
Ours 39.94 0.986 30.80 0.903 MEGA
Ours* 39.98 0.987 31.96 0.916 MEGA
Official 38.99 0.978 31.46 0.904 Github

Due to the huge demand for GPU memory, we have to reduce the batch_size and patch_size:

Ours: batch_size is [64, 40, 32, 16, 8, 8] and patch_size is [32, 40, 48, 64, 80, 96];

Ours*: batch_size is [32, 20, 16, 8, 4, 4] and patch_size is [64, 80, 96, 128, 160, 192].

Results

More results could be downloaded from MEGA. Here we give some examples for Ours*.

vis

restormer's People

Contributors

leftthomas 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

Watchers

 avatar  avatar  avatar

restormer's Issues

非常棒的复现,有个问题想问一下

restormer的模型我这本地跑不了,但是这个模型一大优势就是可以直接处理整张图不掉那么多点。我这边基于MPRnet进行复现时发现与其整张图进行处理不如把图片切分成与训练一样的尺寸进行处理。
基于MPRnet的实验,我这patch=step=128处理时,涨点比直接处理明显;patch=128,step=64时比step=128的psnr要高一点,同理step=32也比step=64的处理要高一点点。patch与patch之间重合的区域是使用粗暴的平均取值的方式。step=patch/2的方式,华为给出了一个更佳的解决方法https://github.com/huawei-noah/Pretrained-IPT/issues/18,缺点就是step不能改小了。
我想问问,如果基于你新训练的restormer模型去切分图片进行处理的话,会不会还能再涨点呢?

Train problem

Thanks for your contribution! There is problem when training,

File "/root/autodl-tmp/Restormer-master/utils.py", line 103, in __getitem__
    image_name = os.path.basename(self.rain_images[idx % self.num])
ZeroDivisionError: integer division or modulo by zero

about milestones

Hi, very good work. But I have a small problem, my computer is a single graphics card Nvidia 3080, both batch_size and patch_size are smaller than the minimum size you proposed, but after 156000milestones, both batch_size and patch_size become bigger, then I get an error on my side——RuntimeError : pixel_unshuffle expects height to be divisible by downscale_factor, but input.size(-2)=49 is not divisible by 2, how do I fix this?

batch_size=16, 10, 8, 4, 2, 2
patch_size=32, 40, 98, 64, 80, 96

模型复现时遇到一点问题想请教一下

您好,看到您非常简洁清楚的复现代码,获益匪浅,但是我在复现您的代码时遇到一些问题,想向您请教,我在进行模型训练时,loss始终维持在0.175左右不再下降,psnr和ssim也分别保持在15和0.45左右不提高,想请教您这是什么原因如何改进,我的相关参数设置如下batch size=[32,20,16,8,4,4],patch size=[64,80,96,128,160,192],milestone=[9200,15600,20400,24000,27600],num_iter=30000

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.