Official PyTorch implementation of Defocus and Similarity Attention Fusion Net (DSAF-Net) in paper A Defocus and Similarity Attention-Based Cascaded Network for Multi-Focus and Misaligned Image Fusion, which is an end-to-end network to merge information from several multi-focus and misaligned images in the focal stack to obtain a clear and detailed image.
- Download the repository:
git clone https://github.com/PeimingCHEN/DSAF-Net
. - Install Python 3.7.10, Pytorch 1.8.1, and CUDA 11.1.
- Install the dependencies:
pip install -r requirement.txt
.
You can find the WHU-MFM dataset here. Please upload the training set to the dataset/
folder and the testing set to the test/
folder. Each sample consists of a focal stack with 5 images. We adopt the 480 × 360 version of WHU-MFM and shuffle it in the unit of the focal stack to train and test DSAF-Net.
- To train the Defocus-Net:
python train.py
. - To train the OpticalFlow-Net:
python train_raft.py
. - To joint training and test the Fusion-Net:
python train_fusion.py
.
A single GPU is enough to carry out it.
More fusion results on WHU-MFM testing dataset are shown in the results/
folder.