Official Pytorch implementation of "CSformer: Bridging Convolution and Transformer for Compressive Sensing" published in IEEE Transactions on Image Processing (TIP).
Dongjie Ye, Zhangkai Ni, Hanli Wang, Jian Zhang, Shiqi Wang, Sam Kwong
- Checkpoint
Checkpoints trained on CoCo dataset can be found from Google Drive or Baidu Netdisk (提取码:fr6m).
Checkpoints trained on BSD400 dataset can be found from Google Drive or Baidu Netdisk (提取码:9lmz).
- Inference
-
Unzip the checkpoint file and place all the files in the ./logs/checkpoint_coco/ or ./logs/checkpoint_bsd400/ directory.
-
Edit the ./cfg.py file to modify the [--testdata_path] by specifying the path to your test datasets.
-
Excute the test script below:
python eval.py --cs_ratio 1 --exp_name coco_test_CS1 --load_path ./logs/checkpoint_coco/checkpoint_CS1.pth --overlap --overlapstep 8
(The available options for [cs_ratio] in our pre-trained model are 1, 4, 10, 25, and 50.)
If you want to test the model wihtout overlapping, you may run the script below:
python eval.py --cs_ratio 1 --exp_name coco_test_CS1 --load_path ./logs/checkpoint_coco/checkpoint_CS1.pth
- Prepare the training dataset.
- Edit the train_script.sh file to modify your python path and the [--data_path], [--dataset] by specifying the path to your training datasets.
- Excute the training script below:
sh train_script.sh
- Find the trained weight in the ./logs/[env]/Model/ folder.
If this code is useful for your research, please cite our paper:
@article{csformer,
author={Ye, Dongjie and Ni, Zhangkai and Wang, Hanli and Zhang, Jian and Wang, Shiqi and Kwong, Sam},
journal={IEEE Transactions on Image Processing},
title={CSformer: Bridging Convolution and Transformer for Compressive Sensing},
year={2023},
volume={32},
number={},
pages={2827-2842},
doi={10.1109/TIP.2023.3274988}}
Thanks for your attention! If you have any suggestion or question, feel free to leave a message here or contact Dongjie Ye ([email protected]).