# DERNN-LNLT for CASSI
This repo is the implementation of paper "Degradation Estimation Recurrent Neural Network with Local and Non-Local Priors for Compressive Spectral Imaging"
# Abstract
In the Coded Aperture Snapshot Spectral Imaging (CASSI) system, deep unfolding networks (DUNs) have demonstrated excellent performance in recovering 3D hyperspectral images (HSI) from 2D measurements. However, some noticeable gaps exist between the imaging model used in DUNs and the real CASSI imaging process, such as the sensing error as well as photon and dark current noise, compromising the accuracy of solving the data subproblem and the prior subproblem in DUNs. To address this issue, we propose a Degradation Estimation Network (DEN) to correct the imaging model used in DUNs by simultaneously estimating the sensing error and the noise level, thereby improving the performance of DUNs. Additionally, we propose an efficient Local and Non-local Transformer (LNLT) to solve the prior subproblem, which not only effectively models local and non-local similarities but also reduces the computational cost of the window-based global Multi-head Self-attention (MSA). Furthermore, we transform the DUN into a Recurrent Neural Network (RNN) by sharing parameters of DNNs across stages, which not only allows DNN to be trained more adequately but also significantly reduces the number of parameters. The proposed DERNN-LNLT achieves state-of-the-art (SOTA) performance with fewer parameters on both simulation and real datasets.
# Comparison with other Deep Unfolding Networks
<div align=center>
<img src="./figures/teaser.png" width = "400" height = "300" alt="">
</div>
Comparison of PSNR-Params with previous HSI DUNs. The PSNR (in dB) is plotted on the vertical axis, while the number of parameters is represented on the horizontal axis. The proposed DERNN-LNLT outperforms the previous DUNs while requiring much fewer parameters.
# Architecture
<div align=center>
<img src="./figures/architecture.png" width = "700" height = "640" alt="">
</div>
The DERNN-LNLT alternatively solves a data problem and a prior subproblem in each recurrent step. Firstly, the DERNN-LNLT unfolds the HQS algorithm within the MAP framework and transfors the DUN into an RNN by sharing parameters across stages. Then, the DERNN-LNLT integrate the Degradation Estimation Network into the RNN, which estimates the degradation matrix for the data subproblem and the noise level for the prior subproblem by residual learning with reference to the sensing matrix. Subsequently, the Local and Non-Local Transformer (LNLT) utilizes the Local and Non-Local Multi-head Self-Attention (MSA) to effectively exploit both local and non-local HSIs priors. Finally, incorporating the LNLT into the DERNN as the denoiser for the prior subproblem leads to the proposed DERNN-LNLT.
# Usage
## Prepare Dataset:
Download cave_1024_28 ([Baidu Disk](https://pan.baidu.com/s/1X_uXxgyO-mslnCTn4ioyNQ), code: `fo0q` | [One Drive](https://bupteducn-my.sharepoint.com/:f:/g/personal/mengziyi_bupt_edu_cn/EmNAsycFKNNNgHfV9Kib4osB7OD4OSu-Gu6Qnyy5PweG0A?e=5NrM6S)), CAVE_512_28 ([Baidu Disk](https://pan.baidu.com/s/1ue26weBAbn61a7hyT9CDkg), code: `ixoe` | [One Drive](https://mailstsinghuaeducn-my.sharepoint.com/:f:/g/personal/lin-j21_mails_tsinghua_edu_cn/EjhS1U_F7I1PjjjtjKNtUF8BJdsqZ6BSMag_grUfzsTABA?e=sOpwm4)), KAIST_CVPR2021 ([Baidu Disk](https://pan.baidu.com/s/1LfPqGe0R_tuQjCXC_fALZA), code: `5mmn` | [One Drive](https://mailstsinghuaeducn-my.sharepoint.com/:f:/g/personal/lin-j21_mails_tsinghua_edu_cn/EkA4B4GU8AdDu0ZkKXdewPwBd64adYGsMPB8PNCuYnpGlA?e=VFb3xP)), TSA_simu_data ([Baidu Disk](https://pan.baidu.com/s/1LI9tMaSprtxT8PiAG1oETA), code: `efu8` | [One Drive](https://1drv.ms/u/s!Au_cHqZBKiu2gYFDwE-7z1fzeWCRDA?e=ofvwrD)), TSA_real_data ([Baidu Disk](https://pan.baidu.com/s/1RoOb1CKsUPFu0r01tRi5Bg), code: `eaqe` | [One Drive](https://1drv.ms/u/s!Au_cHqZBKiu2gYFTpCwLdTi_eSw6ww?e=uiEToT)), and then put them into the corresponding folders of `datasets/` and recollect them as the following form:
```
|--DERNN_LNLT
|--datasets
|--CSI
|--cave_1024_28
|--scene1.mat
|--scene2.mat
:
|--scene205.mat
|--CAVE_512_28
|--scene1.mat
|--scene2.mat
:
|--scene30.mat
|--KAIST_CVPR2021
|--1.mat
|--2.mat
:
|--30.mat
|--TSA_simu_data
|--mask_3d_shift.mat
|--mask.mat
|--Truth
|--scene01.mat
|--scene02.mat
:
|--scene10.mat
|--TSA_real_data
|--mask_3d_shift.mat
|--mask.mat
|--Measurements
|--scene1.mat
|--scene2.mat
:
|--scene5.mat
|--checkpoints
|--csi
|--scripts
|--tools
|--results
|--Quality_Metrics
|--visualization
```
We use the CAVE dataset (cave_1024_28) as the simulation training set. Both the CAVE (cave_1024_28) and KAIST (KAIST_CVPR2021) datasets are used as the real training set.
## Pretrained weights
Download pretrained weights ([Baidu Disk](https://pan.baidu.com/s/1BBQbFnYXx-glqYkrZ9DCSQ), code: `lnlt` | [Google Drive](https://drive.google.com/drive/folders/1aVGHRcHB2svBoYkM3pPCbZO765EXpLd8?usp=sharing)) and put them into `DERNN_LNLT/checkpoints/`
## Simulation Experiement:
### Training
```
cd DERNN_LNLT/
# DERNN-LNLT 5stage
bash ./scripts/train_dernn_lnlt_5stg_simu.sh
# DERNN-LNLT 7stage
bash ./scripts/train_dernn_lnlt_7stg_simu.sh
# DERNN-LNLT 9stage
bash ./scripts/train_dernn_lnlt_9stg_simu.sh
# DERNN-LNLT 9stage*
bash ./scripts/train_dernn_lnlt_9stg_star_simu.sh
```
The training log, trained model, and reconstrcuted HSI will be available in `DERNN_LNLT/exp/` .
### Testing
Place the pretrained model to `DERNN_LNLT/checkpoints/`
Run the following command to test the model on the simulation dataset.
```
cd DERNN_LNLT/
# DERNN_LNLT 5stage
bash ./scripts/test_dernn_lnlt_5stg_simu.sh
# DERNN_LNLT 7stage
bash ./scripts/test_dernn_lnlt_7stg_simu.sh
# DERNN_LNLT 9stage
bash ./scripts/test_dernn_lnlt_9stg_simu.sh
# DERNN_LNLT 9stage*
bash ./scripts/test_dernn_lnlt_9stg_star_simu.sh
```
The reconstrcuted HSIs will be output into `DERNN_LNLT/results/`
```
Run cal_quality_assessment.m
```
to calculate the PSNR and SSIM of the reconstructed HSIs.
### Visualization
- Put the reconstruted HSI in `DERNN_LNLT/visualization/simulation_results/results` and rename it as method.mat, e.g., DERNN_LNLT_9stg_simu.mat
- Generate the RGB images of the reconstructed HSIs
```
cd DERNN_LNLT/visualization/
Run show_simulation.m
```
## Real Experiement:
### Training
```
cd DERNN_LNLT/
# DERNN-LNLT 5stage
bash ./scripts/train_dernn_lnlt_5stg_real.sh
```
The training log and trained model will be available in `DERNN_LNLT/exp/`
### Testing
```
cd DERNN_LNLT/
# DERNN-LNLT 5stage
bash ./scripts/test_dernn_lnlt_5stg_real.sh
```
The reconstrcuted HSI will be output into `DERNN_LNLT/results/`
### Visualization
Generate the RGB images of the reconstructed HSI
```
cd DERNN_LNLT/visualization/
Run show_real.m
```
## Acknowledgements
Our code is based on following codes, thanks for their generous open source:
- [https://github.com/ShawnDong98/RDLUF_MixS2](https://github.com/ShawnDong98/RDLUF_MixS2)
- [https://github.com/caiyuanhao1998/MST](https://github.com/caiyuanhao1998/MST)
- [https://github.com/TaoHuang95/DGSMP](https://github.com/TaoHuang95/DGSMP)
- [https://github.com/mengziyi64/TSA-Net](https://github.com/mengziyi64/TSA-Net)
- [https://github.com/facebookresearch/detectron2](https://github.com/facebookresearch/detectron2)
## Citation
If this code helps you, please consid
没有合适的资源?快使用搜索试试~ 我知道了~
matlab代码“压缩光谱成像的具有局部和非局部先验的退化估计递归神经网络”.zip
共60个文件
py:20个
m:12个
sh:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 56 浏览量
2024-03-18
16:02:40
上传
评论
收藏 3.57MB ZIP 举报
温馨提示
1.版本:matlab2014/2019a/2021a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
资源推荐
资源详情
资源评论
收起资源包目录
matlab代码“压缩光谱成像的具有局部和非局部先验的退化估计递归神经网络”.zip (60个子文件)
matlab代码“压缩光谱成像的具有局部和非局部先验的退化估计递归神经网络”
DERNN-LNLT-main
tools
test_real.py 3KB
train.py 9KB
test_simu.py 4KB
configs
dernn_lnlt_9stg_star_simu.yaml 1KB
dernn_lnlt_9stg_simu.yaml 1KB
dernn_lnlt_5stg_real.yaml 1KB
dernn_lnlt_7stg_simu.yaml 1KB
dernn_lnlt_5stg_simu.yaml 1KB
visualization
show_simulation.m 936B
show_line.m 5KB
spectral_density.png 152KB
dispCubeAshwin.m 115KB
show_simulation.asv 923B
real_results
results
.gitkeep 0B
dispCubeAshwin.asv 117KB
show_real.asv 2KB
show_line.asv 6KB
createfigure.m 2KB
show_real.m 1KB
datasets
.gitkeep 0B
figures
teaser.png 617KB
architecture.png 3.09MB
csi
architectures
__init__.py 34B
dernn_lnlt.py 26KB
metrics
__init__.py 59B
metrics.py 4KB
data
__init__.py 268B
data.py 14KB
utils
utils.py 506B
__init__.py 0B
schedulers.py 2KB
file_io.py 447B
engine
__init__.py 24B
defaults.py 6KB
losses
__init__.py 54B
l1_loss.py 943B
config
__init__.py 36B
defaults.py 3KB
config.py 2KB
checkpoints
.gitkeep 0B
results
.gitkeep 0B
README.md 9KB
Quality_Metrics
CC.m 958B
SpectAngMapper.m 1KB
Cal_quality_assessment.m 875B
img_qi.m 4KB
cal_ssim.m 6KB
csnr.m 372B
quality_assessment.m 1KB
results
README.md 48B
scripts
train_dernn_lnlt_5stg_simu.sh 105B
train_dernn_lnlt_9stg_simu.sh 105B
test_dernn_lnlt_7stg_simu.sh 80B
test_dernn_lnlt_9stg_star_simu.sh 85B
train_dernn_lnlt_7stg_simu.sh 105B
train_dernn_lnlt_5stg_real.sh 105B
test_dernn_lnlt_5stg_simu.sh 80B
test_dernn_lnlt_9stg_simu.sh 80B
train_dernn_lnlt_9stg_star_simu.sh 110B
test_dernn_lnlt_5stg_real.sh 80B
共 60 条
- 1
资源评论
Matlab科研辅导帮
- 粉丝: 3w+
- 资源: 7796
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功