DRRN_paddle

November 9, 2024 · View on GitHub

This repository is implementation of the "Image Super-Resolution via Deep Recursive Residual Network".

参考 : https://github.com/yjn870/DRRN-pytorch

Requirements

  • Paddlepaddle 2.4.0
  • Numpy 1.15.4
  • Pillow 5.4.1
  • h5py 2.8.0
  • tqdm 4.30.0

Prepare

The images for creating a dataset used for training (291-image) or evaluation (Set5) can be downloaded from the paper author's implementation.

You can also use pre-created dataset files with same settings as the paper.

DatasetScaleTypeLink
291-image2, 3, 4TrainDownload
Set52EvalDownload
Set53EvalDownload
Set54EvalDownload

Generate training dataset

python generate_trainset.py --images-dir "BLAH_BLAH/Train_291" \
                            --output-path "BLAH_BLAH/Train_291_x234.h5" \
                            --patch-size 31 \
                            --stride 21

Generate test dataset

python generate_testset.py --images-dir "BLAH_BLAH/Set5" \
                           --output-path "BLAH_BLAH/Set5_x2.h5" \
                           --scale 2

Train

Model weights will be stored in the --outputs-dir after every epoch.

python train.py --train-file "BLAH_BLAH/291-image_x234.h5" \
                --outputs-dir "BLAH_BLAH/DRRN_B1U9" \
                --B 1 \
                --U 9 \
                --num-features 128 \
                --lr 0.1 \
                --clip-grad 0.01 \
                --batch-size 128 \
                --num-epochs 50 \
                --num-workers 8 \
                --seed 123

You can also evaluate using --eval-file, --eval-scale options during training after every epoch. In addition, the best weights file will be stored in the --outputs-dir as a best.pdiparams.

python train.py --train-file "BLAH_BLAH/291-image_x234.h5" \
                --eval-file "BLAH_BLAH/Set5_x3.h5" \
                --outputs-dir "BLAH_BLAH/outputs" \
                --eval-scale 3 \
                --B 1 \
                --U 9 \
                --num-features 128 \
                --lr 0.1 \
                --clip-grad 0.01 \
                --batch-size 128 \
                --num-epochs 50 \
                --num-workers 8 \
                --seed 123

Evaluate

Pre-trained weights can be found in BLAH_BLAH/outputs

python eval.py --weights-file "BLAH_BLAH/outputs/x234/epoch_20.pdiparams" \
               --eval-file "BLAH_BLAH/Set5_x3.h5" \
               --eval-scale 3 \
               --B 1 \
               --U 9 \
               --num-features 128