• Stars
    star
    191
  • Rank 202,877 (Top 4 %)
  • Language
    Python
  • Created about 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SUNet: Swin Transformer with UNet for Image Denoising

[ISCAS 2022] SUNet: Swin Transformer with UNet for Image Denoising

Chi-Mao Fan, Tsung-Jung Liu, Kuan-Hsien Liu

paper official_paper video slides Hugging Face Spaces


Abstract : Image restoration is a challenging ill-posed problem which also has been a long-standing issue. In the past few years, the convolution neural networks (CNNs) almost dominated the computer vision and had achieved considerable success in different levels of vision tasks including image restoration. However, recently the Swin Transformer-based model also shows impressive performance, even surpasses the CNN-based methods to become the state-of-the-art on high-level vision tasks. In this paper, we proposed a restoration model called SUNet which uses the Swin Transformer layer as our basic block and then is applied to UNet architecture for image denoising.

Network Architecture

CMFNet

Overall Framework of SUNet

Swin Transformer Layer

Dual up-sample

Quick Run

You can directly run personal noised images on my space of HuggingFce.

To test the pre-trained models of denoising on your own 256x256 images, run

python demo.py --input_dir images_folder_path --result_dir save_images_here --weights path_to_models

Here is an example command:

python demo.py --input_dir './demo_samples/' --result_dir './demo_results' --weights './pretrained_model/denoising_model.pth'

To test the pre-trained models of denoising on your arbitrary resolution images, run

python demo_any_resolution.py --input_dir images_folder_path --stride shifted_window_stride --result_dir save_images_here --weights path_to_models

SUNset could only handle the fixed size input which the resolution in training phase same as the mostly transformer-based methods because of the attention masks are fixed. If we want to denoise the arbitrary resolution input, the shifted-window method will be applied to avoid border effect. The code of demo_any_resolution.py is supported to fix the problem.

Train

To train the restoration models of Denoising. You should check the following components:

  • training.yaml:

      # Training configuration
      GPU: [0,1,2,3] 
    
      VERBOSE: False
    
      SWINUNET:
        IMG_SIZE: 256
        PATCH_SIZE: 4
        WIN_SIZE: 8
        EMB_DIM: 96
        DEPTH_EN: [8, 8, 8, 8]
        HEAD_NUM: [8, 8, 8, 8]
        MLP_RATIO: 4.0
        QKV_BIAS: True
        QK_SCALE: 8
        DROP_RATE: 0.
        ATTN_DROP_RATE: 0.
        DROP_PATH_RATE: 0.1
        APE: False
        PATCH_NORM: True
        USE_CHECKPOINTS: False
        FINAL_UPSAMPLE: 'Dual up-sample'
    
      MODEL:
        MODE: 'Denoising'
    
      # Optimization arguments.
      OPTIM:
        BATCH: 4
        EPOCHS: 500
        # EPOCH_DECAY: [10]
        LR_INITIAL: 2e-4
        LR_MIN: 1e-6
        # BETA1: 0.9
    
      TRAINING:
        VAL_AFTER_EVERY: 1
        RESUME: False
        TRAIN_PS: 256
        VAL_PS: 256
        TRAIN_DIR: './datasets/Denoising_DIV2K/train'       # path to training data
        VAL_DIR: './datasets/Denoising_DIV2K/test' # path to validation data
        SAVE_DIR: './checkpoints'           # path to save models and images
    
  • Dataset:
    The preparation of dataset in more detail, see datasets/README.md.

  • Train:
    If the above path and data are all correctly setting, just simply run:

    python train.py
    

Result

Visual Comparison

Citation

If you use SUNet, please consider citing:

@inproceedings{fan2022sunet,
  title={SUNet: swin transformer UNet for image denoising},
  author={Fan, Chi-Mao and Liu, Tsung-Jung and Liu, Kuan-Hsien},
  booktitle={2022 IEEE International Symposium on Circuits and Systems (ISCAS)},
  pages={2333--2337},
  year={2022},
  organization={IEEE}
}

visitors

More Repositories

1

CMFNet

Compound Multi-branch Feature Fusion for Real Image Restoration
Python
85
star
2

HWMNet

Half Wavelet Attention on M-Net+ for Low-light Image Enhancement
Python
81
star
3

SRMNet

Selective Residual M-Net for Real Image Denoising
Python
29
star
4

Competition-2024-PyTorch-Tracking

AICUP 2024 Cross-camera Multiple-object tracking
HTML
11
star
5

SRMNet-thesis

Image Restoration thesis
Python
8
star
6

Competition-2023-PyTorch-Badminton

2023 AICUP Badminton
Python
4
star
7

Competition-2021-Pytorch-YOLOv4

AICUP 2021 object detection
Python
4
star
8

WBTP-VTON

Whole Body and Texture Preservation based Virtual Try-on Network
Python
4
star
9

SideProject-2022-Python-GIFMaker

Generate the before\after gif images for image restoration v2
Python
4
star
10

TermProject-2021-ObjectDetection-KITTI

Object detection on KITTI dataset
Jupyter Notebook
3
star
11

Competition-2022-OpenVINO-Devcup

OpenVINO DevCUP music aeparation & transcription
Python
3
star
12

Competition-2021-Python-StockTransaction

Automated trading
Python
2
star
13

Competition-2021-Pytorch-Reggression

IMBD 2021 Data Regression by MLP
Jupyter Notebook
1
star
14

TermProject-2017-Java-AndroidStudio

Android App for Classroom Interaction
Java
1
star
15

SideProject-2022-Python-ZoomCropMaker

Generate the zoom patch with the original images for visual comparisons
Python
1
star
16

RevisionWork-2020-Matlab-ColorQuantization

3D color quantization
MATLAB
1
star
17

TermProject-2021-EmbeddedSystem

Real Time Streaming on the Arduino Car with Android App Controller
Java
1
star
18

SideProject-2021-Matlab-GIFMaker

Generate the before\after gif images for image restoration
MATLAB
1
star