/pytorch-deepglr

A pytorch implementation of Deep Graph Laplacian Regularization for image denoising

Primary LanguagePython

pytorch-deepglr

A pytorch implementation of Deep Graph Laplacian Regularization for image denoising. Original work: Zeng et al.

Table of Contents

Installation

  1. Clone this repository

    git clone https://github.com/huyvd7/pytorch-deepglr
    
  2. Install required packages listed in requirements.txt (with Python 3.7)

Basic usage

We provide implementations for both DeepGLR and GLR since DeepGLR is a stacking version of GLRs. GLR is a smaller network and can be test more quickly, but it has poorer performance than DeepGLR.

Evaluate a trained model

Evaluate DeepGLR

python validate_DGLR.py dataset/sample/ -m model/YOUR_MODEL -w

Evaluate GLR

python validate_GLR.py dataset/sample/ -m model/YOUR_MODEL -w 

The above commands resize the input images located at dataset/sample/ to square images with size width x width, then performs evaluation for the given trained model model/YOUR_MODEL and saves outputs to current directory.

Train a model

Train a DeepGLR

python train_DGLR.py dataset/sample/ -n MODEL_NAME -d ./ -w width -e epoch -b batch_size -l learning_rate

The above command will train a new DeepGLR. If you want to continue training an existing DeepGLR instead of training from scratch, you can add -m PATH_TO_EXISTED_MODEL:

python train_DGLR.py dataset/train/ -m model/deepglr.pretrained -n MODEL_NAME -d ./ -w width -e epoch -b batch_size -l learning_rate

Train a GLR

python train_GLR.py dataset/train/ -n MODEL_NAME -d ./ -w width -e epoch -b batch_size -l learning_rate

Same parameters as DeepGLR.

Remove noise of a single image using a trained DeepGLR (LEGACY, MIGHT NOT WORKING)

python denoise.py dataset/test/noisy/2_n.bmp -m model/deepglr.pretrained -w 324 -o OUTPUT_IMAGE.PNG

The above command will resize the dataset/test/noisy/2_n.bmp to 324x324, then denoise it using a trained DeepGLR model/deepglr.pretrained and save the result at OUTPUT_IMAGE.PNG.