PyTorch implementation of "LF-AFnet: Angular-Flexible Network for Light Field Image Super-Resolution".
- Python 3.5+
- PyTorch 1.0+(http://pytorch.org/)
- Skimage
- Numpy
- MatLab (For training/test data generation)
We used the EPFL, HCInew, HCIold, INRIA and STFgantry datasets for both training and test. Please first download our dataset via Baidu Drive (key:nudt), and place the 5 datasets to the folder ./datasets/
.
- Run
Generate_Data_for_train.m
to generate training data. The generated data will be saved in./data_for_train/
(x2_SR, x4_SR). - Run
Generate_Data_for_test.m
to generate input LFs of the test set. The generated data will be saved in./data_for_test/
(x2_SR, x4_SR).
- Run
train.py
to perform network training and validation. Note that, the training settings intrain.py
should match the generated training data. - Checkpoint will be saved to
./log/
. - During the training, validation patches will be printed in
./log/
.
We also provide the solution of distributed GPUs. Technically there are no limits to the operation system to run the code, but Linux system is recommended, on which the project has been tested.
$ CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train.py --model_name LF_AFnet --scale_factor 2 --data_name ALL --batch_size 2 --use_pre_ckpt True --path_pre_pth ./LF_AFnet_x2_epoch_50_model.pth --path_demo ./demo/ --angRes_demo 5 --path_demo_result ./demo_result/
$ CUDA_VISIBLE_DEVICES=0,1 python -m torch.distributed.launch --nproc_per_node=2 train.py --model_name LF_AFnet --scale_factor 4 --data_name ALL --batch_size 2 --use_pre_ckpt True --path_pre_pth ./LF_AFnet_x4_epoch_50_model.pth --path_demo ./demo/ --angRes_demo 5 --path_demo_result ./demo_result/
We provide our pretrained models. You can run demo.py
to easily perform network inference, and your LFs saved in ./demo/
will be super-resolved. The output will be saved in./demo_result/
. Note that, the angular resolution (i.e., angRes) of your LFs is required.
$ python demo.py --model_name LF_AFnet --scale_factor 2 --use_pre_ckpt True --path_pre_pth ./LF_AFnet_x2_epoch_50_model.pth --path_demo ./demo/ --angRes_demo 5 --path_demo_result ./demo_result/
$ python demo.py --model_name LF_AFnet --scale_factor 4 --use_pre_ckpt True --path_pre_pth ./LF_AFnet_x4_epoch_50_model.pth --path_demo ./demo/ --angRes_demo 5 --path_demo_result ./demo_result/
If you find this work helpful, please consider citing the following paper:
@article{LF_AFnet,
title={Angular-flexible network for light field image super-resolution},
author={Liang, Zhengyu and Wang, Yingqian and Wang, Longguang and Yang, Jungang and Zhou, Shilin},
journal={Electronics Letters},
publisher={Wiley Online Library}
}
## Acknowledgement **The imresize part of our code is referred from [matlab_imresize](https://github.com/fatheral/matlab_imresize). We thank the author for sharing codes.**
Any question regarding this work can be addressed to zyliang@nudt.edu.cn and wangyingqian16@nudt.edu.cn.