Code for HQSS: Shadow Removal by High-Quality Shadow Synthesis Paper
This code uses the following libraries
- python 3.7+
- pytorch 1.1+ & tochvision
- scikit-image
- focal-frequency-loss
Generate the training data using the original ISTD dataset and the code gettraindata.m
or download the training data from: GoogleDrive: ISTD | BaiduNetdisk: ISTD (Access code: 1111)
Your ~/AISTD/
folder should look like this
AISTD
├── train/
├── train_A/
│ └── 90-1.png
│ └── ...
├── train_B/
│ └── ...
└── ...
We need to crop the original images to non-shadaow/shadow image. The suitable crop mask is computed as like G2R-ShadowNet
Please ensure mask pickle are exists. Lines 38/48
of datasets_decouple.py
You can download these pickle generated by us from here or use map_dict.py
to produce the pickle.
GoogleDrive: ISTD
- Set the paths:
Lines 104/105
oftrain_shadow_generation_network.py
- Set the paths:
Lines 210-226
ofutils.py
python train_shadow_generation_network.py
-
Set the paths:
Lines 134/135/217/222
oftrain_shadow_removal_network.py
-
python train_shadow_removal_network.py
-
Set the paths:
Lines 30-34/56/57
oftest.py
/Lines 29-33/53/54
oftest_SRD.py
-
python test.py/test_SRD.py
- Set the paths of the shadow removal results and the dataset in
evaluate.m/evaluate_SRD.m
- Run
evaluate.m/evaluate_SRD.m
GoogleDrive: ISTD
GoogleDrive: SRD
GoogleDrive: ISTD
GoogleDrive: ISTD
Method | Shadow Region | Non-shadow Region | All |
---|---|---|---|
Le & Samaras (ECCV20) | 10.4 | 2.9 | 4.0 |
G2R-ShadowNet (CVPR21) | 8.9 | 2.9 | 3.9 |
HQSS (Ours) | 8.48 | 2.82 | 3.72 |
Results in shadow and non-shadow regions are computed on each image first and then compute the average of all images in terms of RMSE.
Method | RMSE | RMSE$_{40}$ | PSNR | SSIM |
---|---|---|---|---|
Le & Samaras (ECCV20) | - | 20.9 | - | - |
G2R-ShadowNet (CVPR21) | 21.8 | 18.8 | 21.07 | 0.882 |
HQSS (Ours) | 18.95 | 16.82 | 21.89 | 0.888 |
RMSE$_{40}$ denotes that the moving-shadow mask is computed with a threshold of 40. Other results use the moving-shadow mask which is computed with a threshold of 80.
Code is implemented based on G2R-ShadowNet