/DIFAN

Simple Lens Imaging ,Large-FOV

Primary LanguagePythonApache License 2.0Apache-2.0

DIFAN for simple lens imaging system

Simple Lens Imaging ,Large-FOV

DIFAN: Deep Iterative Filter Adaptive Network for Simple Lens Imaging System

This repo contains training and evaluation code for the following paper:

[Filter Adaptive Network for Simple Lens Imaging System]

*sensor


Getting Started

Prerequisites

Tested environment

Python PyTorch CUDA

1. Environment setup

  • Option 1. install from scratch
    $ git clone https://github.com/codeslake/DIFAN.git
    $ cd DIFAN
    
    ## for CUDA11.7
    $ conda create -y --name DIFAN python=3.9 && conda activate DIFAN
    $ sh install_CUDA11.7.sh
    
    ## for CUDA11.1 or CUDA11.3
    $ conda create -y --name DIFAN python=3.8 && conda activate DIFAN
    # CUDA11.1
    $ sh install_CUDA11.1.sh
    
  • Option 2. docker
    $ nvidia-docker run --privileged --gpus=all -it --name DIFAN --rm codeslake/DIFAN /bin/hy
    $ git clone https://github.com/codeslake/DIFAN.git
    $ cd IFAN
    
    # for CUDA11.1
    $ coda activate DIFAN_CUDA11.1
    
    # for CUDA11.3 (for amp)
    $ coda activate DIFAN_CUDA11.3 
    
    # for CUDA11.7 
    $ coda activate DIFAN_CUDA11.7

2. Datasets

Download and unzip datasets under [DATASET_ROOT]:

[DATASET_ROOT]
 ├── DPDD
 ├── DPDD-SL

[DATASET_ROOT] can be modified with config.data_offset in ./configs/config.py.

3. Pre-trained models

Download and unzip pretrained weights ([Baidu Netdisk](https://pan.baidu.com/s/1Jd2VfnbfVHuZaOip4DYN9Q?pwd=z7jd 提取码:z7jd) | Dropbox under ./ckpt/:

.
├── ...
├── ./ckpt
│   ├── DIFAN.pytorch
│   ├── ...
│   
└── ...

Testing models

## Table 2 in the main paper
# Our final model used for comparison
python run.py --mode DIFAN --network DIFAN --config config_DIFAN --data test --ckpt_abs_name ckpt/DIFAN_TEST.pytorch --data_offset ./DATASET_ROOT --output_offset ./output

 python run.py --mode DIFAN --network DIFAN --config config_DIFAN --data DPDD-SL --ckpt_abs_name ckpt/DIFAN_TEST.pytorch --data_offset ./DATASET_ROOT --output_offset ./output

> Testing results will be saved in `[LOG_ROOT]/2023/[mode]/result/quanti_quali/[mode]_[epoch]/[data]/`.

> `[LOG_ROOT]` can be modified with [`config.log_offset`]

#### Options
* `--data`: The name of a dataset to evaluate. `DPDD-SL`  `random`. Default: `DPDD-SL`
    * The folder structure can be modified in the function [`set_eval_path(..)`]
    * `random` is for testing models with any images, which should be placed as `[DATASET_ROOT]/random/*.[jpg|png]`.

## Contact
Open an issue for any inquiries.
You may also have contact with (e-mail:huang2020bit@163.com)

## Citation
If you find this code useful, please consider citing:

@InProceedings{DIFAN2023, author = {HUANG}, title = {Iterative Filter Adaptive Network for Simple Lens Imaging System}, booktitle = {Advances in lasers and optoelectronics}, year = {2024.5} }