This repository is based on Lightweight Image Super-Resolution with Information Multi-distillation Network (ACM MM 2019)
-
This repositoty is test version of IMDN-Quant which is gonna porting to mobile device
-
I quantize convolution layer in IMDN model (Fake quantization) you can simulate the effect of conv2d quantize layer by changing fake_quant.py
-
After analyzing Quantization loss, this model will be ported to Mobile device
setups
conda create -n imdn python=3.8
conda activate imdn
pip install pytorch scikit-image==0.16.2 opencv-python==3.4.8.29
#IMDN model is devloped in 2019, so you need old version scikit-image, opencv-python libraray
- Runing testing:
# Set5 x2 IMDN wiht conv2d layer quantization
python test_quant_IMDN.py --test_hr_folder Test_Datasets/Set5/ --test_lr_folder Test_Datasets/Set5_LR/x2/ --output_folder results/Set5/x2 --checkpoint checkpoints/IMDN_x2.pth --upscale_factor 2
# Set5 x2 IMDN
python test_IMDN.py --test_hr_folder Test_Datasets/Set5/ --test_lr_folder Test_Datasets/Set5_LR/x2/ --output_folder results/Set5/x2 --checkpoint checkpoints/IMDN_x2.pth --upscale_factor 2
# RealSR IMDN_AS
python test_IMDN_AS.py --test_hr_folder Test_Datasets/RealSR/ValidationGT --test_lr_folder Test_Datasets/RealSR/ValidationLR/ --output_folder results/RealSR --checkpoint checkpoints/IMDN_AS.pth
- Calculating IMDN_RTC's FLOPs and parameters, input size is 240*360
python calc_FLOPs.py
- Download Training dataset DIV2K
- Convert png file to npy file
python scripts/png2npy.py --pathFrom /path/to/DIV2K/ --pathTo /path/to/DIV2K_decoded/
- Run training x2, x3, x4 model
python train_IMDN.py --root /path/to/DIV2K_decoded/ --scale 2 --pretrained checkpoints/IMDN_x2.pth
python train_IMDN.py --root /path/to/DIV2K_decoded/ --scale 3 --pretrained checkpoints/IMDN_x3.pth
python train_IMDN.py --root /path/to/DIV2K_decoded/ --scale 4 --pretrained checkpoints/IMDN_x4.pth