DC-ShadowNet
Introduction
This is an implementation of the following paper DC-ShadowNet: Single-Image Hard and Soft Shadow Removal Using Unsupervised Domain-Classifier Guided Network. (ICCV'2021) Yeying Jin, Aashish Sharma and Robby T. Tan
Abstract
Shadow removal from a single image is generally still an open problem. Most existing learning-based methods use supervised learning and require a large number of paired images (shadow and corresponding non-shadow images) for training. A recent unsupervised method, Mask-ShadowGAN, addresses this limitation. However, it requires a binary mask to represent shadow regions, making it inapplicable to soft shadows. To address the problem, in this paper, we propose an unsupervised domain-classifier guided shadow removal network, DC-ShadowNet. Specifically, we propose to integrate a shadow/shadow-free domain classifier into a generator and its discriminator, enabling them to focus on shadow regions. To train our network, we introduce novel losses based on physics-based shadow-free chromaticity, shadow-robust perceptual features, and boundary smoothness. Moreover, we show that our unsupervised network can be used for test-time training that further improves the results. Our experiments show that all these novel components allow our method to handle soft shadows, and also to perform better on hard shadows both quantitatively and qualitatively than the existing state-of-the-art shadow removal methods.
Overview of the proposed method:
Datasets
-
SRD (please download train and test from the authors). Extracted Shadow Masks in the SRD Dataset
Shadow Removal Results:
- SDR Dataset DC-ShadowNet Results, All Results
-
AISTD Dataset DC-ShadowNet Results, All Results
-
LRSS Soft Shadow Dataset DC-ShadowNet Results, All Results
-
ISTD Dataset DC-ShadowNet Results
-
USR Dataset DC-ShadowNet Results
Evaluation
The default root mean squared error (RMSE) evaluation code used by all methods (including ours) actually computes mean absolute error (MAE).
- The faster version MAE evaluation code
- The original version MAE evaluation code
1.1 SRD Dataset, set the paths of the shadow removal result and the dataset in demo_srd_release.m and then run it.
Get the following Table 1 in the main paper on the SRD dataset (size: 256x256).
Method | Training | All | Shadow | Non-Shadow |
---|---|---|---|---|
DC-ShadowNet | Unpaired | 4.66 | 7.70 | 3.39 |
Mask-ShadowGAN | Unpaired | 6.40 | 11.46 | 4.29 |
DSC | Paired | 4.86 | 8.81 | 3.23 |
DeShadowNet | Paired | 5.11 | 3.57 | 8.82 |
Gong | Prior | 12.35 | 25.43 | 6.91 |
Input Image | N/A | 13.77 | 37.40 | 3.96 |
1.2 AISTD Dataset, set the paths of the shadow removal result and the dataset in demo_aistd_release.m and then run it.
Get the following Table 2 in the main paper on the AISTD dataset (size: 256x256).
Method | Training | All | Shadow | Non-Shadow |
---|---|---|---|---|
DC-ShadowNet | Unpaired | 4.6 | 10.3 | 3.5 |
1.3 LRSS Soft Shadow Dataset, set the paths of the shadow removal result and the dataset in demo_lrss_release.m and then run it.
Get the following Table 3 in the main paper on the LRSS dataset (size: 256x256).
Method | Training | All |
---|---|---|
DC-ShadowNet | Unpaired | 3.48 |
Input Image | N/A | 12.26 |
Pre-trained Model
-
Download the pre-trained SRD model, put in results/SRD/model/
-
Download the pre-trained AISTD model, put in results/AISTD/model/
-
Download the pre-trained ISTD model, put in results/ISTD/model/
-
Download the pre-trained USR model, put in results/USR/model/
Test
python main_test.py --dataset SRD --datasetpath YOURPATH --phase test
Results: results/SRD/iteration/outputB
Train
- Implement the papers On the removal of shadows from images (TPAMI,05) and Recovery of Chromaticity Image Free from Shadows via Illumination Invariance (ICCV,03)
Directory
- Download Datasets and run 1, get the Shadow-Free Chromaticity Maps after Illumination Compensation, and put them in the trainC folder, you should see the following directory structure.
${DC-ShadowNet-Hard-and-Soft-Shadow-Removal}
|-- dataset
|-- SRD
|-- trainA ## Shadow
|-- trainB ## Shadow-free
|-- trainC ## Shadow-Free Chromaticity Maps after Illumination Compensation
|-- testA ## Shadow
|-- testB ## Shadow-free
...
- python main.py --dataset SRD --phase train
Shadow-Robust Feature Get the following Figure 5 in the main paper, VGG feature visualization code is in feature_release folder,
python test_VGGfeatures.py
Results: ./results_VGGfeatures/shadow_VGGfeatures/layernumber/imagenumber/visual_featurenumber_RMSE.jpg
Boundary Smoothness Loss Get the following Figure 8 in the main paper, shadow boundary code is in boundary_smooth folder,
run getRTVdenMask.m
Results: input_softmask_boundary.jpg
Citation
Please kindly cite our paper if you are using our codes: