ShapeMoire

Pytorch implementation of [ShapeMoire: Channel-Wise Shape-Based Network for Image Demoireing].

Usage

Environment Installation

  1. Requirements

    • Linux or macOS (Windows is not currently officially supported)
    • Python 3.8
    • PyTorch 1.9.0
    • CUDA 11.1
    • GCC 7.3.0
  2. Install dependencies.

    Here is a full script for setting up ShapeMoire with conda.

    # build conda environment
    conda create -n shapemoire python=3.8 -y
    conda activate shapemoire
    
    # install latest PyTorch prebuilt with the default prebuilt CUDA version 
    conda install pytorch torchvision -c pytorch
    
    # install other dependencies
    conda install lpips==0.1.4 numpy==1.25.2 opencv_python==4.8.0.76 Pillow==10.0.1 PyYAML==6.0.1 skimage==0.0 tensorboardX==2.6.2.2 thop==0.1.1.post2209072238 tqdm==4.66.1
    

Data Preparation

  1. Download Dataset

    You can download four open datasets: FHDMi, TIP2018, UHDM and LCDMoire from the Internet.

    Link dataset path under $ShapeMoire/data.

  2. Data Structure

    Finally, the total data structure is shown like this:

    Shapemoire/
    |---configs/
    |---data/
    |   |---FHDMi/
    |   |   |---train/
    |   |   |---test/
    |   |---TIP2018/
    |   |   |---train/
    |   |   |---test/
    |   |---UHDM/
    |   |   |---train/
    |   |   |---test/
    |   |---LCDMoire/
    |   |   |---train/
    |   |   |---test/
    

Modeling

  1. Train

    For training process, we use config file in $ShapeMoire/configs to define model, dataset and hyber parameters.

    Run the following command to start a training process. You should specify the model and dataset before training.

    python train_{MODEL_NAME}.py --config {DATASET_NAME}.yaml

    Note:

    • The default config file is defined to train Shapemoire. For training baseline model, modify config with 'TEST_BASELINE: True'.
    • For ESDNet, in order to train ESDNet-L, modify config with 'SAM_NUM:2'.
  2. Test

    Run the following command to start a testing process.

    Except for choosing model and dataset, You need to specify the checkpoint using the parameter 'LOAD_PATH' within config.

    python test_{MODEL_NAME}.py --config {DATASET_NAME}.yaml

Main Results

ArchitectureMethodPSNRParams. (M)
UHDMFHDMiTIP2018LCDMoire
ESDNetBaseline22.25324.39329.79145.2865.394
ShapeMoire22.59724.62929.86245.5375.394
+0.3440.2360.0710.2510
ESDNet-LBaseline22.55424.80830.09645.54410.623
ShapeMoire22.94825.06430.16146.55810.623
+0.3940.2560.0651.0140
WDNetBaseline19.18221.16127.81237.3243.360
ShapeMoire19.88222.18228.31238.4083.360
+0.5001.0210.5001.0840
DMCNNBaseline17.81219.31324.51929.3211.426
ShapeMoire18.03619.61525.38129.6491.426
+0.2230.3020.8620.3290