Skip to content

Pytorch implementation of "CSformer: Bridging Convolution and Transformer for Compressive Sensing"

Notifications You must be signed in to change notification settings

Lineves7/CSformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSformer: Bridging Convolution and Transformer for Compressive Sensing (TIP 2023)

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

Testing (Running pretrained models)

  • 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
  1. Unzip the checkpoint file and place all the files in the ./logs/checkpoint_coco/ or ./logs/checkpoint_bsd400/ directory.

  2. Edit the ./cfg.py file to modify the [--testdata_path] by specifying the path to your test datasets.

  3. 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
    

Training (Training from scratch)

  1. Prepare the training dataset.
  2. Edit the train_script.sh file to modify your python path and the [--data_path], [--dataset] by specifying the path to your training datasets.
  3. Excute the training script below:
    sh train_script.sh
    
  4. Find the trained weight in the ./logs/[env]/Model/ folder.

Citation

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}}

Contact

Thanks for your attention! If you have any suggestion or question, feel free to leave a message here or contact Dongjie Ye ([email protected]).

About

Pytorch implementation of "CSformer: Bridging Convolution and Transformer for Compressive Sensing"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published