Skip to content

Vinylow/SpA-Former-shadow-removal

 
 

Repository files navigation

SpA-Former:Transformer image shadow detection and removal via spatial attention

GitHub repo size GitHub top language GitHub issues
GitHub watchers GitHub stars GitHub forks

new

Results of shadow removal on ISTD dataset

image)

Quick Run

To test the pre-trained models of shadow-removal on your own images, run

python demo.py --task Task_Name --input_dir path_to_images --result_dir save_images_here

Pretrained model

  1. Download the pretrained model shadow-removal Google-drive and Baidu Drive 提取码:rpis

Test results

Our test results: Google-drive and Baidu drive 提取码:18ut

Dataset

Download datasets RICE from here, and ISTD dataset from here

To reproduce PSNR/SSIM/RMSE scores of the paper, run MATLAB script

evaluate.m

ACKNOLAGEMENT

The code is updated on [https://github.com/Penn000/SpA-GAN_for_cloud_removal)]

2. DATASET

2.1. ISTD_DATASET

Click official address Build the file structure as the folder data shown. Here input is the folder where the shadow image is stored and the folder target stores the corresponding no shadow images.

./
+-- data
    +--	ISTD_DATASET
        +-- train
        |   +-- input
        |   |   +-- 0.png
        |   |   +-- ...
        |   +-- target
        |       +-- 0.png
        |       +-- ...
        +-- test
            +-- input
            |   +-- 0.png
            |   +-- ...
            +-- target
                +-- 0.png
                +-- ...

3. TRAIN

Modify the config.yml to set your parameters and run:

python train.py

4. TEST

python predict.py --config <path_to_config.yml_in_the_out_dir> --test_dir <path_to_a_directory_stored_test_data> --out_dir <path_to_an_output_directory> --pretrained <path_to_a_pretrained_model> --cuda

There're my pre-trained models on ISTD(./pretrained_models/ISTD/gen_model_epoch_200.pth)

Some results are shown as bellow and the images from left to right are: input, attention map, SpA-Former's output, ground truth.

image)

5. EXPERIMENTS

In this section, I compares SpA-Former with several methods using peak signal to noise ratio (PSNR) and structural similarity index (SSIM) and (RMSE) as metrics on datasets ISTD.

image)

6. CONTACT

Contact me if you have any questions about the code and its execution.

E-mail: SemiZxf@163.com

If you think this work is helpful for your research, give me a star :-D

Citations

@article{Xiao Feng Zhang,
  title={SpA-Former: Transformer image shadow detection and removal via spatial attention},
  author={Xiao Feng Zhang, Chao Chen Gu, Shan Ying Zhu},
  journal={arXiv preprint arXiv:2206.10910},
  year={2022}}

About

Code for paper: SpA-Former:Transformer image shadow detection and removal via spatial attention

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 93.9%
  • MATLAB 6.1%