Cast and Attached Shadow Detection via Iterative Light and Geometry Reasoning
Shilin Hu, Jingyi Xu, Sagnik Das, Dimitris Samaras, Hieu Le
[Paper] [Project Page]
Accepted to ECCV 2026.
Updates:
- 09-29-2026: Released the training and testing code.
- 09-10-2026: Added a corrected evaluation protocol for future comparisons while retaining the reported protocol for paper reproduction.
- 09-09-2026: Updated the dataset with additional mask corrections.
We introduce a framework that jointly detects cast and attached shadows by reasoning about their mutual relationship with scene illumination and geometry.
- Shadow detection module: predicts both shadow types separately.
- Light estimation module: infers the light direction from the detected shadows and inputs.
The estimated light direction, combined with surface normals, produces a geometry-consistent map of likely self-occluded regions, which is fed back to iteratively refine both shadow segmentation and light estimation.
Download the Cast and Attached Shadow Dataset
This dataset contains 1,458 images derived from WSRD, SOBA, and CUHK-Shadow and is provided for noncommercial academic research. The original source datasets retain their respective rights and terms: WSRD is under CC BY-NC-SA 4.0, CUHK-Shadow is under CC BY-NC-SA 3.0, and SOBA is distributed through its official public research release. Please cite accordingly when using this dataset.
Python 3.9 is recommended. The code was tested with Python 3.9.17, PyTorch 1.13.1, torchvision 0.14.1, and CUDA 11.7.
conda create -n attached-shadow python=3.9
conda activate attached-shadow
pip install -r requirements.txtTraining uses the Cast–Attached Shadow Dataset and the SBU-trained PVT-B5 initialization from SILT.
Set data_root, backbone_checkpoint, and output_dir in configs/train.yaml, then run:
CUDA_VISIBLE_DEVICES=0,1 bash scripts/train.shThe paths can also be specified from the command line:
bash scripts/train.sh \
--data_root /path/to/ECCV_castattached \
--backbone_ckpt /path/to/SILT_PVTb5_SBU.pth \
--output_dir /path/to/outputDownload the final model checkpoint
Set data_root, model_checkpoint, and output_dir in configs/test.yaml, then run:
CUDA_VISIBLE_DEVICES=0 bash scripts/test.shThe paths can also be specified from the command line:
bash scripts/test.sh \
--data_root /path/to/ECCV_castattached \
--ckpt /path/to/attached_shadow_detection_eccv26.pth \
--save_dir /path/to/resultsThe evaluator provides two protocols:
standardis now the default and is recommended for comparisons with other methods. It binarizes ground-truth masks at 0.5 and computes metrics from conventional binary confusion matrices.reportedreproduces the values reported for our method in the paper. It retains fractional boundary values rather than binarizing them, so boundary pixels contribute differently to the metrics. Its results therefore differ from the standard protocol.
Select the protocol with:
bash scripts/test.sh --protocol standard
bash scripts/test.sh --protocol reportedResults using the corrected standard evaluation protocol:
Best results are bold and second-best results are italicized.
| Method | Full BER↓ | Full F1↑ | Cast BER↓ | Cast F1↑ | Attached BER↓ | Attached F1↑ |
|---|---|---|---|---|---|---|
| BDRAR | 21.31 | 70.51 | 7.11 | 79.82 | 35.31 | 52.37 |
| DSD | 22.55 | 68.73 | 7.70 | 80.27 | 35.83 | 51.78 |
| FSDNet | 24.47 | 66.08 | 10.38 | 79.35 | 37.42 | 46.29 |
| MTMT | 33.11 | 49.96 | 15.04 | 74.84 | 41.93 | 38.12 |
| FDRNet | 23.71 | 65.67 | 8.83 | 71.81 | 34.72 | 55.19 |
| SDCM | 24.29 | 66.48 | 7.75 | 83.58 | 36.73 | 49.06 |
| SILT | 20.22 | 71.49 | 4.51 | 80.56 | 32.60 | 60.29 |
| BDRAR† | 8.14 | 83.98 | 5.05 | 73.07 | 20.65 | 82.79 |
| FSDNet† | 10.17 | 85.12 | 5.69 | 82.16 | 19.39 | 80.66 |
| FDRNet† | 8.62 | 83.03 | 4.51 | 73.48 | 23.02 | 81.52 |
| SILT† | 6.49 | 83.07 | 4.37 | 68.62 | 26.42 | 80.85 |
| Ours | 7.95 | 84.46 | 6.33 | 82.79 | 16.60 | 83.76 |
† Fine-tuned on the training split.
By default, evaluation prints all full-shadow, cast-shadow, attached-shadow, and light-direction metrics and saves visual prediction panels. To report metrics without saving images, run:
CUDA_VISIBLE_DEVICES=0 bash scripts/test.sh --metrics-onlyRepresentative qualitative results on single images:
Qualitative results on our dataset. From left to right: input image, BDRAR, FSDNet, FDRNet, SILT, Ours, and GT (Green: Attached, Red: Cast).Qualitative time-lapse results:
Time-lapse qualitative results (top to bottom): Brick, Potted Plant, Sun Clock.
If you find this work useful, please cite:
@misc{hu2026castattachedshadowdetection,
title={Cast and Attached Shadow Detection via Iterative Light and Geometry Reasoning},
author={Shilin Hu and Jingyi Xu and Sagnik Das and Dimitris Samaras and Hieu Le},
year={2026},
eprint={2512.06179},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2512.06179},
}



