Manuscript Offprint
arXiv:2609.01806Consistency as Regularization for Unsupervised Shadow Removal
Abstract
Shadow removal is an important preprocessing step for many vision tasks, yet existing supervised methods require paired shadow and shadow-free images, while unsupervised approaches often still rely on shadow masks or shadow-free references. We propose ShadowCLR, an unsupervised framework that learns shadow removal directly from shadow images. Our key observation is that shadows vary across observations while the underlying scene content remains largely consistent. We therefore use consistency across shadow observations as regularization, encouraging the model to recover scene-consistent appearance while suppressing shadow-specific variations. Global and local consistency further enable us to explore visually related images, learn from imperfectly aligned observations, and focus the representation on shared scene information. Experiments on multiple benchmarks show that ShadowCLR achieves competitive and often superior performance over state-of-the-art unsupervised methods, demonstrating that consistency can provide regularization for shadow removal without shadow masks or shadow-free images.
1. Introduction
Shadows are common in visual data and can degrade downstream tasks such as change detection, surveillance, 3D reconstruction, and scene understanding [1, 7, 30, 50, 52]. By disrupting illumination, texture, and color statistics, they may introduce false detections and reconstruction errors. Shadow removal is therefore an important preprocessing step in many real-world applications, yet remains difficult because of the complex interaction between illumination, scene geometry, and surface reflectance [27].
Recent deep learning approaches [4, 23, 37, 40, 41, 59, 62, 64] achieve strong shadow removal performance by training on paired shadow and shadow-free images. However, constructing such paired data requires substantial collection effort and careful alignment, making it difficult to scale to unconstrained scenarios. Unsupervised meth-

Figure 1. Illustration of our core idea. Shadow patterns vary across observations, but scene content remains consistent. We use this consistency to learn shadow removal.
ods [18, 26, 28, 36, 42, 43] reduce this requirement, but typically still depend on shadow masks or unpaired shadow-free images, which remain difficult to obtain at scale.
In practice, the same scene may appear under different shadow and illumination conditions while preserving its underlying content. Motivated by this observation, we introduce Shadow Consistency Learning for Removal (Shadow-CLR), an unsupervised shadow removal framework that exploits consistency across shadow observations as a source of supervision. As illustrated in Fig. 1, the model learns to retain scene-consistent information while suppressing shadow-dependent variations. Visually related images are automatically discovered when available, while a shadow generator ensures that the framework remains applicable even when such related images are limited or absent. The main contributions are:
- We propose unsupervised shadow removal that requires neither target shadow masks nor shadow-free images and learns via consistency of shadow observations.
- Our framework can also perform unsupervised shadow segmentation as a natural byproduct of shadow removal.
- Our framework achieves competitive, and in some cases superior results compared with current state-of-the-art unsupervised methods.
The rest of this paper is organized as follows. Section 2 reviews related works. Section 3 describes the proposed method. Section 4 reports experimental results and analysis. Finally, Section 5 concludes the paper.
2.1. Supervised deep shadow removal
Early deep shadow removal approaches mainly adopted supervised learning with paired shadow and shadow-free images. DeShadowNet [49] introduced a multi-context embedding architecture, followed by ST-CGAN [58], which jointly addressed shadow detection and removal using adversarial learning. Later methods improved spatial reasoning and illumination estimation, including DSC [25], RISGAN [65], and DHAN [6], with designs based on spatial context, residual learning, and hierarchical feature aggregation. Subsequent works incorporated physical priors [14, 35, 39, 70], style guidance [57], and invertible or transformer-based architectures [16, 61, 69].
More recently, diffusion models have been increasingly explored for shadow removal. ShadowDiffusion [17], DeS3 [29], and latent diffusion approaches [46] exploit generative priors to improve illumination restoration. More recent methods such as Diff-Shadow [45] and Detail-Preserving Latent Diffusion [63] further enhance reconstruction quality in both shadow and non-shadow regions. Despite their strong performance, supervised methods still depend on costly paired datasets, which limits their use in less controlled environments.
2.2. Unsupervised deep shadow removal
To alleviate the dependence on paired training data, unsupervised methods learn from unpaired or weakly supervised samples. Existing methods can mainly be grouped into two categories. The first relies on unpaired shadow and shadow-free images. Mask-ShadowGAN [26], LG-ShadowNet [42], DC-ShadowNet [28], S3R-Net [34], and FASR-Net [38] exploit shadow-free images through adversarial or frequency-domain learning. The second avoids shadow-free references but still requires shadow masks. Le et al. [36] and G2R [43] use mask-guided consistency, while Guo et al. [18] use masks to guide a diffusion process.
Obtaining reliable shadow-free references or accurate shadow masks nevertheless remains difficult in practice. Existing approaches often use ground-truth masks provided by datasets or masks generated by supervised shadow detectors [68], which may limit their applicability.
2.3. Unsupervised deep shadow detection
Shadow detection aims to localize shadow regions and has been studied alongside shadow removal and generation [19, 27]. Early pre-deep-learning methods explored region-level optimization [56]. Other approaches ASD [12], HSV-Shadow [31], and Zhang et al. [66] exploit hand-crafted shadow cues using traditional-based strategies to localize shadow regions. Despite these efforts, deep unsupervised shadow detection has received relatively limited attention. Meanwhile, several unsupervised shadow removal methods still rely on accurate shadow masks obtained from manual annotations or supervised shadow detectors [36, 43]. This dependency limits their applicability where shadow annotations are unavailable. Therefore, developing unsupervised shadow detection or shadow removal methods that do not rely on shadow masks is a crucial step.
3. Proposed method
As introduced in Sec. 1, our key idea is to leverage consistency among different shadow observations for unsupervised shadow removal. In Fig. 2, we provide an overview of the framework, and this section details each component.
3.1. Pairwise image loss
To reconstruct an image, we employ a UNet architecture . Although diffusion-based models achieve strong performance [18, 45], we choose UNet for simple single-pass inference; an iterative refinement illustrating diffusion-style is provided in the supplementary material. Assuming image groups are available, we sample two batches and such that and are in the same group, each group appears once in , and use as the pseudo-target for reconstructing . Since shadow regions may differ between and , training across multiple pairs encourages to approach a group-consistent appearance.
However, a group-consistent appearance may correspond to either removing shadows or introducing similar shadows across images. As shadowed regions are typically darker, we introduce a task-specific module that enforces a one-way transformation toward shadow removal:
where controls the adjustment strength. This formulation blends with , ensuring the output mainly brightens shadowed regions while allowing small decreases for smooth transitions if needed. With this sigmoid-based gating and an objective function , the model learns to remove shadows that are not consistently present across different observations of the same group.
In addition, some regions may remain shadowed across all observations within a group, making the pseudo-target

Figure 2. Overview of the proposed framework. Images are first grouped by self-refining image grouping (Sec. 3.2). Within each group, the network learns to remove shadows by pairwise reconstruction (Sec. 3.1) and patch-wise correspondence loss (Sec. 3.3), optimized under the overall objective in Sec. 3.4.
term alone insufficient. We therefore introduce a reconstruction consistency term . Once the model produces a brighter correction for such a region in one observation, this term encourages the paired reconstruction toward the same corrected appearance. Combined with the one-way brightness bias imposed by the sigmoid gating, these corrections can be progressively reinforced across different pairs. Additionally, relying only on this consistency term may lead to trivial constant outputs. Moreover, images within the same group are not necessarily pixel-aligned due to camera shifts, illumination variations, or moving objects as illustrated in Fig. 3b. We therefore include a self-reconstruction term to preserve the input-specific content and appearance.
However, this introduces a data assumption that similar images must be available during training. To address this, we use a shadow generator . For simplicity, we adopt RandomShadow [2], which generates shadows by randomly selecting polygonal regions in the image and reducing their brightness. This alleviates the data assumption and allows our method to be trained even when similar images are scarce or absent (). Combining all terms, the final reconstruction loss becomes:
As all components of compare images of identical resolution, their weights are set equally for simplicity. We also examine the impact of different parameters in Sec. 4.5. Together, these terms promote consistent shadow removal across each group, reduce sensitivity to imperfect pixel-level alignment, and enable training even without visually related images.
3.2. Self-refining image grouping
As Sec. 3.1 assumes access to image groups, we next consider how such groups can be obtained. While these relationships may be available from camera metadata, we con-

(a) Examples of image groups discovered.

(b) Examples of configuration variations across similar images.

(c) Illustration of patch-wise correspondence loss.
Figure 3. Visualization of the proposed grouping and correspondence strategy: discovered pseudo groups, variations among similar images, and patch-wise matching for misaligned regions.
sider the more general setting where neither group labels nor the number of groups is known. We initialize pseudo labels using Affinity Propagation [13], which does not require the number of groups and using the default parameters [48] on precomputed pairwise image distances.
During the forward pass of the paired batches and defined in Sec. 3.1, the shadow generator is first applied to each image before feeding it to the shared UNet. We collect the last -normalized global UNet encoder features and corresponding to and , respectively. Since and belong to the same pseudo group, forms a positive pair, while the remaining features in the two batches are treated as negatives. We then have a global contrastive loss:
where the temperature hyper-parameter is set to 0.3 following the standard practice [9, 22]. The stop-gradient term acts as a confidence weight: samples already close to each other receive a stronger attraction, while uncertain assignments are updated more conservatively (detailed in the supplementary material). After each epoch, we re-extract the last -normalized global UNet encoder features for all training images and compute their pairwise cosine similarities. Affinity Propagation is then reapplied to these similarities to obtain updated pseudo labels for the next epoch, allowing the grouping and feature representations to progressively refine each other. As illustrated in Fig. 3a, the resulting pseudo groups contain visually related images despite variations in shadows and illumination.
This self-refining scheme directly uses the UNet encoder, avoiding any auxiliary model or heavy pretrained backbone. By minimizing the distance between positive pairs while separating negative pairs, the contrastive objective encourages the encoder to capture scene-level information that is consistent across different observations while suppressing shadow-specific variations. This provides cleaner and more consistent representations for the decoder, improving the quality of the restored images. Comparing images in the learned feature space also reduces sensitivity to the pixel-level variations discussed in Sec. 3.1.
3.3. Patch-wise correspondence loss
As discussed in Sec. 3.1, images within the same group may not be perfectly pixel-aligned due to camera shifts, illumination variations, or moving objects as illustrated in Fig. 3b. Although the global contrastive learning in Sec. 3.2 reduces the influence of these variations at the scene level, global representations alone may not sufficiently constrain local structures. We therefore introduce a patch-wise correspondence mechanism, illustrated in Fig. 3c.
Given input images , , we extract multi-scale feature maps and from the UNet encoder, where denotes the feature dimension and its spatial resolution of the -th layer among UNet layers. Each spatial location is treated as a patch-wise feature and is -normalized along the feature dimension. We also obtain a global representation for each feature map by spatial mean pooling followed by normalization. The correspondence loss is defined as:
Similar to the global contrastive loss in Sec. 3.2, the stop-gradient weight assigns stronger supervision to more confident correspondences. Here, the positive pair is formed between corresponding local patches, whereas each anchor patch is contrasted with the mean feature of each image from other groups. Since this mean aggregates information from all patches of the negative image, it allows each patch-wise feature to be compared against the overall image content without directly treating every patch from another group as a negative. This reduces false-negative constraints when similar objects also appear in different groups. Unlike LPIPS [67] feature matching at identical spatial locations, we search for the most similar patch in the paired image, relaxing the spatial alignment assumption and improving robustness to camera shifts and moving objects.
3.4. Overall framework
The pairwise reconstruction in Sec. 3.1 learns shadow removal by enforcing consistency either between images from the same group or between different shadow generations of the same image. Visually related images are automatically discovered by the self-refining grouping in Sec. 3.2. The global and patch-wise contrastive objectives further encourage the model to preserve scene-consistent information while suppressing shadow variations, and relax the need for pixel-level alignment under camera shifts or moving objects. The overall objective is a combination of three terms:
where balance the grouping and patch-wise correspondence terms, respectively. Overall the regularization is derived solely from consistency constraints together with the prior that shadow regions are darker, encoded by the sigmoid gating and shadow generation, without requiring shadow masks or shadow-free images.
4. Experiments
In this section, we evaluate the proposed method in Sec. 3, compare it with existing approaches in Sec. 4.2, show qualitative results in Sec. 4.3, and analyze its components through ablation studies in Sec. 4.5.
4.1. Experimental settings
Setups. We implemented our method in PyTorch [47], running all experiments on a single NVIDIA H100 GPU. Following prior works [18, 28, 43], all images are resized to for both training and testing. For image restoration, we use a lightweight U-Net trained from scratch, following [26, 43], to isolate the effect of our framework without relying on pretrained restoration or diffusion models. At inference, the model costs 0.05 TFLOPs per image. As reported in Tabs. 1, 2 and 8, our parameters and FLOPs remain comparable to other non-diffusion-based unsupervised methods, whereas diffusion-based methods such as Guo et al. [18] require 61 TFLOPs. The model is trained for 100 epochs with batch size 8 using the Adam optimizer [32], a learning rate of , and hyperparameters , . We also analyze in Secs. 4.5 and 8 the effect of , and .
Datasets. We evaluate our method on AISTD [35], INS [62], WSRD+ [53, 54], LRSS [15], SRD [49], and the video shadow removal dataset [36]. AISTD (also referred to as ISTD+) is an adjusted version of the ISTD dataset [58] with reduced illumination discrepancies in non-shadow areas, which is important since unsupervised methods have no access to shadow-free images. AISTD includes 1,330 shadow images for training and 540 for testing. SRD contains 2,680 shadow images for training and 408 for testing. INS contains 30,000 training images, and 2,000 testing images. The video dataset contains 8 videos of static scenes with consistent backgrounds.
Evaluation metrics. We follow prior works [18, 42] and use MATLAB to compute Root Mean Square Error (RMSE), Peak Signal-to-Noise Ratio (PSNR), and Structural Similarity Index (SSIM) [60] for evaluation. RMSE is computed over the three Lab channels, while PSNR and SSIM are calculated in RGB to assess visual fidelity and structural consistency. A lower RMSE indicates a smaller reconstruction error, while a higher PSNR and SSIM values correspond to better restoration quality.
4.2. Comparison with the state-of-the-art
In this section, we compare ShadowCLR with state-of-the-art methods for shadow removal. The comparison includes a classic method: Guo et al. [20]; supervised methods: DHAN [6], AEF [14], BM-Net [69], ShadowFormer [16], ShadowDiffusion [17], HomoFormer [61], and Omnisr [62]; and unsupervised methods: Mask-ShadowGAN [26], LG-ShadowNet [42], DC-ShadowNet [28], Le et al. [36], G2R [43], Guo et al. [18], S3R-Net [34], and FASR-Net [38]. All results are taken from the original papers while results produced by official implementations are shown in italic.
In Tab. 1, we report the quantitative comparison on the AISTD dataset. Supervised methods achieve strong performance by training on paired shadow and shadow-free images. Unsupervised methods also achieve competitive results, in some cases approaching the performance of supervised ones; however, they typically depend on shadow-free references and/or shadow masks for guidance. On the other hand, ShadowCLR achieves competitive results compared with state-of-the-art unsupervised methods. Specifically, our method surpasses early supervised approaches such as DHAN [6] and AEF [14].
In Tab. 2, we report the quantitative comparison on the SRD, LRSS, WSRD+ and INS datasets. Following [28], the LRSS results are obtained by fine-tuning a model pretrained on SRD, while other results are obtained by training on the respective dataset. Unlike AISTD, which provides ground-truth shadow masks, these datasets do not include shadow mask annotations. As many unsupervised meth-
ods rely on shadow mask supervision, we have to use the generated masks from other shadow detection methods to evaluate the performance of these methods. Compared with the other evaluated unsupervised baselines, ShadowCLR achieves higher performance across all metrics and datasets. Note that INS is a synthetic dataset representing scenarios where similar images are scarce or absent.
4.3. Qualitative results
The qualitative results on the AISTD and SRD datasets are shown in Figs. 4 and 5. In both cases, ShadowCLR effectively removes shadows while maintaining color consistency and preserving scene details. Compared to prior unsupervised methods such as Mask-ShadowGAN, LG-ShadowNet, and DC-ShadowNet, our method generates results that are visually cleaner and closer to the ground truth. Notably, ShadowCLR better restores surface textures and illumination transitions, especially in challenging regions such as partially overlapping with dark objects. These visual outcomes further confirm the quantitative improvements in Tabs. 1 and 2. Note that Guo et al. [18] did not release code or outputs; therefore, their method is excluded from the qualitative comparison.
4.4. Grouping quality
Only AISTD provides scene group information through image filenames. We therefore use these filename-derived groups as ground truth to evaluate grouping quality. Grouping with pairwise produces 115 groups with an average of 11.57 images per group ranging from 2 to 111 images and an ARI of 0.588. Using DINov3 features gives 114 groups with 11.67 images per group on average ranging from 4 to 27 images and an ARI of 0.700. After training, our method produces 119 groups with an average of 11.18 images per group ranging from 3 to 27 images, increasing the ARI to 0.918. The ground truth contains 89 groups with an average of 14.94 images per group, ranging from 1 to 29 images. On average, 98.80% of the shadow pixels have at least one non-shadow observation within their ground truth group, 66.43% of the candidate images provide a non-shadow observation for the anchor's shadow pixels. Nevertheless, recovering the ground-truth grouping is difficult while the presence of singleton groups makes selecting a fixed representative image as a pseudo-target unreliable.
More specifically, with and DINov3 grouping, only 50.55% and 53.40% of the candidate images, respectively, provide a correct non-shadow observation for the anchor's shadow pixels (non-shadow may differ from the ground truth). Selecting higher-ranked candidates does not fully solve this issue: the 70th percentile provides correct observations for only 66.21% and 70.29% of the anchor's shadow pixels, while the 90th percentile reaches 69.86% and 75.44%. After self-refinement, these values improve to
Table 1. Quantitative comparison results of ShadowCLR with the state-of-the-art methods on the AISTD dataset [35, 58]. The best and second-best results within each setting are highlighted in bold and underlined, respectively.
| Method | SettingFree Mask | Complexity | Shadow Region (S) | Non-Shadow Region (N) | All Image (A) | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TFLOPS | Params (M) | PSNR ↑ | SSIM ↑ | RMSE ↓ | PSNR ↑ | SSIM ↑ | RMSE ↓ | PSNR ↑ | SSIM ↑ | RMSE ↓ | ||
| Guo et al. [20] | Classic | - | - | 26.89 | 0.960 | 20.1 | 35.48 | 0.975 | 3.1 | 25.51 | 0.924 | 6.1 |
| DHAN [6] | Supervised | 0.26 | 21.8 | 32.92 | 0.988 | 9.6 | 27.15 | 0.971 | 7.4 | 25.66 | 0.956 | 7.8 |
| AEF [14] | - | 196.76 | 36.04 | 0.978 | 6.7 | 31.16 | 0.892 | 3.8 | 29.45 | 0.861 | 4.2 | |
| BMNet [69] | - | 0.58 | 37.87 | 0.991 | 5.6 | 37.51 | 0.985 | 2.5 | 33.98 | 0.972 | 3.0 | |
| ShadowFormer [16] | - | 11.37 | 39.48 | 0.992 | 5.2 | 38.82 | 0.983 | 2.3 | 35.46 | 0.971 | 2.8 | |
| ShadowDiffusion [17] | - | 55.52 | 39.69 | 0.992 | 5.0 | 38.89 | 0.987 | 2.3 | 35.67 | 0.975 | 2.7 | |
| HomoFormer [61] | - | 17.81 | 39.49 | 0.993 | 4.7 | 38.75 | 0.984 | 2.2 | 35.35 | 0.975 | 2.6 | |
| Mask-ShadowGAN [26] | ✓ | 0.05 | 22.8 | 32.19 | 0.984 | 10.8 | 33.44 | 0.974 | 3.8 | 28.81 | 0.946 | 4.8 |
| LG-ShadowNet [42] | ✓ | 0.03 | 5.7 | 32.44 | 0.982 | 9.9 | 33.68 | 0.971 | 3.4 | 29.20 | 0.945 | 4.4 |
| DC-ShadowNet [28] | ✓ | 0.05 | 10.6 | 31.06 | 0.976 | 12.2 | 27.03 | 0.961 | 6.8 | 25.03 | 0.926 | 7.8 |
| Le et al. [36] | ✓ | - | - | 33.09 | 0.983 | 10.4 | 35.26 | 0.977 | 2.9 | 30.12 | 0.950 | 4.0 |
| G2R [43] | ✓ | 0.11 | 22.8 | 33.58 | 0.979 | 8.9 | 35.52 | 0.976 | 2.9 | 30.52 | 0.944 | 3.9 |
| Guo et al. [18] | ✓ | 61 | 113.7 | 35.71 | 0.986 | 7.6 | 36.39 | 0.981 | 2.7 | 32.11 | 0.959 | 3.5 |
| S3R-Net [34] | ✓ | - | - | - | - | 12.2 | - | - | 6.4 | - | - | 7.1 |
| FASR-Net [38] | ✓ | - | - | 31.89 | 0.982 | 8.61 | 34.57 | 0.978 | 2.8 | 27.58 | 0.934 | 3.8 |
| ShadowCLR (Ours) | 0.05 | 11.4 | 37.47 | 0.989 | 5.9 | 36.96 | 0.984 | 2.6 | 33.35 | 0.964 | 3.1 | |
Table 2. Quantitative comparison results of ShadowCLR with the state-of-the-art methods on the SRD [49], INS [62], LRSS [15], and WSRD+ [54] datasets. The best and second-best results within each setting are highlighted in bold and underlined, respectively.
| Method | SettingFree Mask | Complexity | INS | WSRD+ | LRSS | SRD | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| TFLOPS | Params (M) | PSNR ↑ | SSIM ↑ | PSNR ↑ | SSIM ↑ | PSNR ↑ | SSIM ↑ | PSNR ↑ | SSIM ↑ | ||
| DHAN [6] | Supervised | 0.26 | 21.8 | 27.84 | 0.963 | - | - | 25.57 | - | 30.74 | 0.958 |
| AEF [14] | - | 196.76 | 27.91 | 0.957 | 21.66 | 0.752 | - | - | 28.40 | 0.893 | |
| BMNet [69] | - | 0.58 | 27.90 | 0.958 | 24.75 | 0.816 | - | - | 31.69 | 0.956 | |
| ShadowFormer [16] | - | 11.37 | 28.62 | 0.963 | 25.44 | 0.820 | 31.91 | 0.876 | 32.90 | 0.958 | |
| ShadowDiffusion [17] | - | 55.52 | 29.12 | 0.966 | - | - | - | - | 34.73 | 0.970 | |
| HomoFormer [61] | - | 17.81 | 28.98 | 0.965 | - | - | - | - | 35.37 | 0.972 | |
| Omnisr [62] | - | - | 30.38 | 0.973 | 26.07 | 0.835 | 33.62 | 0.892 | 32.87 | 0.969 | |
| Mask-ShadowGAN [26] | ✓ | 0.05 | 22.8 | 24.91 | 0.928 | 20.31 | 0.741 | 30.83 | 0.852 | 30.49 | 0.947 |
| LG-ShadowNet [42] | ✓ | 0.03 | 5.7 | 25.79 | 0.933 | 21.94 | 0.752 | 31.28 | 0.857 | 30.85 | 0.946 |
| DC-ShadowNet [28] | ✓ | 0.05 | 10.6 | 26.48 | 0.941 | 22.62 | 0.761 | 31.01 | 0.861 | 31.53 | 0.955 |
| G2R [43] + DHAN [6] | ✓ | 0.11+0.26 | 22.8+21.8 | 24.21 | 0.932 | 18.04 | 0.726 | 29.23 | 0.845 | 29.12 | 0.945 |
| G2R [43] + SDDNet [5] | ✓ | 0.11+0.01 | 22.8+46.5 | 25.06 | 0.925 | 19.10 | 0.738 | 28.47 | 0.839 | 29.38 | 0.948 |
| ShadowCLR (Ours) | 0.05 | 11.4 | 28.07 | 0.960 | 23.81 | 0.793 | 31.54 | 0.868 | 31.93 | 0.958 | |
63.87% overall and 86.54%/92.99% at the 70th/90th percentiles, respectively, but still does not provide a reliable valid pseudo-target. This becomes particularly problematic when a group contains only one image or when images from different scenes are incorrectly grouped together. These observations motivate learning from pairwise consistency rather than relying on a median or high-percentile group representative as a fixed pseudo-target.
4.5. Ablation studies
Following [18, 43], we conduct ablations on AISTD, which provides scene-level information and the most reported unsupervised shadow removal results. ARI gain is the difference before and after training; all variants use initialization except DINOv3-based variants, which use pairwise DINOv3 feature similarity. As shown in Table 3, each component contributes to performance. Replacing the patchwise loss with LPIPS or fine-tuning DINOv3 [51] with the global contrastive loss instead of directly optimizing the UNet reduces performance, showing that contrastive learning is more effective when jointly improving the restoration model. Removing the shadow generator has little effect when similar images are available. For gating, better preserves non-shadow regions, while better restores shadows. Using only with the shadow generator ( without grouping) performs worse than DINOv3 grouping and one-image-per-group, especially for shadow detection and restoration. This suggests that feature-level consistency helps learn more general appearance representations even across images from different GT groups. One image per GT group still performs comparably to Mask-ShadowGAN despite fewer training images. The iterative diffusion-style variant and further ablations are given in the supplementary. Using a constant confidence weight also reduces ARI gain and restoration quality, especially PSNR, indicating less accurate RGB color recovery.
4.6. Unsupervised shadow segmentation
Shadow removal inherently provides cues for locating shadow regions, as it involves estimating where illumination should be compensated. We extend ShadowCLR to perform unsupervised shadow segmentation by directly using the sigmoid-based gating map introduced in Sec. 3.1 as a proxy soft shadow matte. The gating map is converted

Figure 4. Qualitative comparison on the AISTD dataset [35, 58]. ShadowCLR produces cleaner and more natural results compared to other unsupervised methods, effectively restoring illumination and surface texture.

Figure 5. Comparison on the SRD dataset [49]. Compared to DC-ShadowNet, ShadowCLR better removes shadows and preserves natural brightness and texture in non-shadow regions.
Table 3. Ablation study of different components and parameter settings on the AISTD dataset. The best and second-best results are highlighted in bold and underlined, respectively.
| Method | Shadow Region | Non-Shadow Region | All Image | ARI abs. gain | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| PSNR | SSIM | RMSE | PSNR | SSIM | RMSE | PSNR | SSIM | RMSE | ||
| Input | 20.83 | 0.930 | 39.01 | 37.46 | 0.985 | 2.40 | 20.46 | 0.894 | 8.40 | - |
| Ours with group | 25.82 | 0.943 | 20.99 | 32.70 | 0.971 | 4.25 | 25.14 | 0.915 | 6.43 | 19.25 |
| Ours + DINOv3 group | 29.42 | 0.970 | 14.02 | 33.08 | 0.971 | 4.21 | 26.52 | 0.929 | 5.72 | 12.31 |
| Ours | 32.18 | 0.981 | 10.08 | 34.02 | 0.975 | 3.72 | 28.96 | 0.943 | 4.58 | 8.02 |
| Ours w/o shadow generator | 37.06 | 0.990 | 5.89 | 37.08 | 0.985 | 2.52 | 32.98 | 0.965 | 3.14 | 2.17 |
| Ours confidence weight=1 | 36.12 | 0.987 | 6.02 | 35.42 | 0.980 | 3.04 | 31.89 | 0.960 | 3.42 | 2.25 |
| Ours + LPIPS | 35.22 | 0.986 | 7.04 | 35.86 | 0.981 | 2.88 | 31.73 | 0.955 | 3.75 | 3.68 |
| Ours on DINOv3 | 35.61 | 0.986 | 6.81 | 36.05 | 0.982 | 2.79 | 32.00 | 0.956 | 3.46 | 3.45 |
| Ours | 36.62 | 0.988 | 5.92 | 36.31 | 0.983 | 2.96 | 32.72 | 0.961 | 3.38 | 1.83 |
| Ours | 37.18 | 0.990 | 5.64 | 36.53 | 0.983 | 2.77 | 33.02 | 0.964 | 3.24 | 1.66 |
| Ours | 37.43 | 0.988 | 5.91 | 37.09 | 0.983 | 2.56 | 33.39 | 0.963 | 3.16 | 1.50 |
| Ours | 36.74 | 0.988 | 5.88 | 36.27 | 0.982 | 2.71 | 32.88 | 0.960 | 3.31 | 1.88 |
| Ours (s = 64) | 36.28 | 0.988 | 6.18 | 37.38 | 0.985 | 2.43 | 33.22 | 0.963 | 3.15 | 1.73 |
| Ours (s = 256) | 38.21 | 0.990 | 5.49 | 36.19 | 0.979 | 2.89 | 33.04 | 0.962 | 3.18 | 1.59 |
| Ours | 37.47 | 0.989 | 5.86 | 36.96 | 0.984 | 2.64 | 33.35 | 0.964 | 3.13 | 1.77 |
| Ours 1 image+GT group | 35.15 | 0.987 | 8.24 | 35.32 | 0.977 | 3.54 | 30.62 | 0.951 | 4.22 | 4.12 |
| Ours trained on SRD | 34.71 | 0.983 | 8.21 | 35.01 | 0.976 | 3.22 | 30.71 | 0.949 | 4.12 | 3.36 |
| Ours w GT group | 37.49 | 0.990 | 5.60 | 37.70 | 0.985 | 2.41 | 33.55 | 0.970 | 2.91 | 1.90 |
| Ours trained on SRD + AISTD | 38.28 | 0.990 | 5.52 | 36.70 | 0.984 | 2.64 | 34.05 | 0.965 | 2.92 | 1.68 |
| Ours iterative (Sec. 6) | 38.94 | 0.992 | 5.11 | 37.12 | 0.985 | 2.40 | 34.23 | 0.972 | 2.50 | 1.21 |
to grayscale using standard luminance weights. Following [3, 6], we train the model on the combined SRD and AISTD datasets and evaluate the performance on AISTD. We further train and test on the SBU dataset [55], which contains 638 test images. The qualitative and quantitative
results are shown in Fig. 6 and Tab. 4. Compared with AISTD, whose shadows mainly appear on relatively planar surfaces, SBU contains more complex shadows across diverse surfaces, leading to lower performance; the same trend is also observed across both supervised and unsupervised methods.

Figure 6. Unsupervised shadow segmentation on SBU dataset using the gating map g.
4.7. Video shadow removal
We further evaluate ShadowCLR on the public video shadow removal dataset [36], which contains static scenes with consistent backgrounds. Each sequence provides a
Table 4. Comparison on shadow detection.
| Method | Setting | SBU | AISTD | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| BER | mloU | Precision | Recall | F1 | BER | mloU | Precision | Recall | F1 | ||
| MTMT [1] | 6.32 | 75.61 | 87.53 | 84.55 | 86.01 | 3.15 | 87.97 | 90.75 | 96.06 | 92.28 | |
| ECA [11] | Supervised | 7.08 | 75.63 | 91.51 | 81.21 | 86.05 | 2.03 | - | - | - | - |
| SDDNet [5] | 5.39 | 76.05 | 83.96 | 88.47 | 86.16 | 1.27 | - | - | - | - | |
| HSV Shadow [31] | 6.51 | - | - | - | - | 18.91 | - | - | - | - | |
| ASD [12] | 15.69 | - | - | - | - | 12.45 | - | - | - | - | |
| Zhang et al. [6] | Unsupervised | 7.13 | - | - | - | - | 5.57 | - | - | - | - |
| Ours | 6.84 | 71.46 | 77.92 | 91.84 | 84.29 | 1.68 | 82.41 | 83.87 | 97.56 | 90.20 | |
pseudo shadow-free reference frame , obtained by taking the maximum pixel intensity across all frames. Following prior works [18, 36, 42, 43], we directly apply the model trained on AISTD to these sequences and additionally report results for a variant fine-tuned for one epoch.
Table 5. Quantitative comparison results on video shadow removal. All metrics are computed in the moving-shadow region; RMSE* uses a threshold of 40, while others use 80. '+' denotes models fine-tuned for one epoch.
| Method | PSNR | SSIM | RMSE | RMSE |
|---|---|---|---|---|
| SP+M-Net [35] | - | - | - | 22.2 |
| Le et al. [36] | - | - | - | 20.9 |
| Le et al. + [36] | - | - | - | 18.0 |
| Mask-ShadowGAN [26] | 20.38 | 0.887 | 22.7 | 19.6 |
| LG-ShadowNet [42] | 20.68 | 0.880 | 22.0 | 18.3 |
| G2R [43] | 21.07 | 0.882 | 21.8 | 18.8 |
| G2R+ [43] | - | - | 18.7 | - |
| Guo et al. [18] | 22.23 | 0.893 | - | 17.7 |
| ShadowCLR (Ours) | 22.52 | 0.896 | 19.5 | 17.0 |
| ShadowCLR+ (Ours) | 22.94 | 0.911 | 18.6 | 14.4 |

Figure 7. Qualitative results on the video shadow dataset [36].
The evaluation focuses on moving-shadow regions, defined as pixels that alternate between shadowed and non-shadowed states throughout the video. The moving-shadow mask is generated according to the official protocol in [36] using a threshold of 80. All quantitative metrics are computed within the moving-shadow region. Following prior works, RMSE is additionally reported with a threshold of 40, while the remaining metrics use the standard threshold of 80. As shown in Tab. 5 and Fig. 7, ShadowCLR achieves superior performance among unsupervised methods.
4.8. Limitation and discussion
A main limitation of our method lies in preserving very fine details and small shadow structures. Although feature-level consistency and patch-wise correspondence alleviate misalignment caused by camera shifts or moving objects, subtle changes such as grass moving between observations may not be sufficiently represented in the learned features, leading to slight detail degradation as shown in Fig. 8. Similar discrepancies may also occur in supervised learning when pairs are captured at different times. The failure cases further show that smaller s better preserves complex scene details, whereas larger s is more effective for complex shadows. More advanced refinement strategies could potentially alleviate this issue; for example, Hu et al. [24] fine-tune SAM [33] to obtain shadow-invariant segmentation, which could be used to enforce texture consistency across materials and boundaries. The shadow generator could also be improved to produce more diverse and realistic shadow variations. Such refinement could be incorporated in future work. In this work, we intentionally retain a lightweight formulation to emphasize the core idea.

Figure 8. Failure cases of our method. Regions with fine details, small shadow structures may appear slightly blurred due to the learning strategy. We include G2R for comparison, while our method still achieves higher PSNR.
5. Conclusion
We introduced ShadowCLR, an unsupervised framework for shadow removal that learns without relying on shadow masks or shadow-free references. By enforcing consistency among images at pixel, global, and patch-wise levels; the model effectively learns to restore illumination and remove shadows in a self-supervised manner. Extensive experiments show that ShadowCLR achieves competitive, and in some cases superior, results compared with unsupervised state-of-the-art approaches. Overall, our results indicate that consistency learning offers a practical and effective direction for unsupervised shadow removal.
References
[1] Jean-Yves Bouguet and Pietro Perona. 3d photography using shadows in dual-space geometry. International Journal of Computer Vision, 35(2):129–149, 1999. 1
[2] Alexander Buslaev, Vladimir I Iglovikov, Eugene Khvedchenya, Alex Parinov, Mikhail Druzhinin, and Alexandr A Kalinin. Albumentations: fast and flexible image augmentations. Information, 11(2):125, 2020. 3
[3] Zhihao Chen, Lei Zhu, Liang Wan, Song Wang, Wei Feng, and Pheng-Ann Heng. A multi-task mean teacher for semi-supervised shadow detection. In Proceedings of the IEEE/CVF Conference on computer vision and pattern recognition, pages 5611–5620, 2020. 7, 8
[4] Zipei Chen, Chengjiang Long, Ling Zhang, and Chunxia Xiao. Canet: A context-aware network for shadow removal. In ICCV, pages 4743–4752, 2021. 1
[5] Runmin Cong, Yuchen Guan, Jinpeng Chen, Wei Zhang, Yao Zhao, and Sam Kwong. Sddnet: Style-guided dual-layer disentanglement network for shadow detection. In Proceedings of the 31st ACM international conference on multimedia, pages 1202–1211, 2023. 6, 8
[6] Xiaodong Cun, Chi-Man Pun, and Cheng Shi. Towards ghost-free shadow removal via dual hierarchical aggregation network and shadow matting gan. In AAAI, pages 10680–10687, 2020. 2, 5, 6, 7
[7] Xueyan Dong, Jiannong Cao, and Weiheng Zhao. A review of research on remote sensing images shadow detection and application to building extraction. European Journal of Remote Sensing, 57(1):2293163, 2024. 1
[8] Anh-Kiet Duong, Petra Gomez-Krämer, and Jean-Michel Carozza. Collision-resistant single-pass method for unsupervised fine-grained image hashing. In 2026 IEEE International Conference on Image Processing (ICIP), pages 1–6, 2026. 4
[9] Anh-Kiet Duong, Marie-Claire Iatrides, Petra Gomez-Krämer, and Jean-Michel Carozza. From image hashing to scene change detection. In International Conference on Pattern Recognition, pages 643–657. Springer, 2026. 3
[10] Martin Ester, Hans-Peter Kriegel, Jörg Sander, Xiaowei Xu, et al. A density-based algorithm for discovering clusters in large spatial databases with noise. In kdd, pages 226–231, 1996. 4
[11] Xianyong Fang, Xiaohao He, Linbo Wang, and Jianbing Shen. Robust shadow detection by exploring effective shadow contexts. In Proceedings of the 29th ACM International Conference on Multimedia, pages 2927–2935, 2021. 8
[12] Vander Luis de Souza Freitas, Barbara Maximino da Fonseca Reis, and Antonio Maria Garcia Tommaselli. Automatic shadow detection in aerial and terrestrial images. Boletim de Ciências Geodésicas, 23(4):578–590, 2017. 2, 8
[13] Brendan J Frey and Delbert Dueck. Clustering by passing messages between data points. science, 315(5814):972–976, 2007. 3
[14] Lan Fu, Changqing Zhou, Qing Guo, Felix Juefei-Xu, Hongkai Yu, Wei Feng, Yang Liu, and Song Wang. Auto-
exposure fusion for single-image shadow removal. In CVPR, pages 10571–10580, 2021. 2, 5, 6
[15] Maciej Gryka, Michael Terry, and Gabriel J Brostow. Learning to remove soft shadows. ACM Transactions on Graphics (TOG), 34(5):1–15, 2015. 5, 6
[16] Lanqing Guo, Siyu Huang, Ding Liu, Hao Cheng, and Bihan Wen. Shadowformer: Global context helps shadow removal. In AAAI, pages 710–718, 2023. 2, 5, 6
[17] Lanqing Guo, Chong Wang, Wenhan Yang, Siyu Huang, Yufei Wang, Hanspeter Pfister, and Bihan Wen. Shadowdiffusion: When degradation prior meets diffusion model for shadow removal. In CVPR, pages 14049–14058, 2023. 2, 5, 6
[18] Lanqing Guo, Chong Wang, Wenhan Yang, Yufei Wang, and Bihan Wen. Boundary-aware divide and conquer: A diffusion-based solution for unsupervised shadow removal. In ICCV, pages 13045–13054, 2023. 1, 2, 4, 5, 6, 8, 3
[19] Lanqing Guo, Chong Wang, Yufei Wang, Siyu Huang, Wenhan Yang, Alex C Kot, and Bihan Wen. Single-image shadow removal using deep learning: A comprehensive survey. arXiv preprint arXiv:2407.08865, 2024. 2
[20] Ruiqi Guo, Qieyun Dai, and Derek Hoiem. Paired regions for shadow detection and removal. IEEE transactions on pattern analysis and machine intelligence, 35(12):2956–2967, 2012. 5, 6
[21] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in neural information processing systems, 33:6840–6851, 2020. 1
[22] Feiran Hu, Chenlin Zhang, Jiangliang Guo, Xiu-Shen Wei, Lin Zhao, Anqi Xu, and Lingyan Gao. An asymmetric augmented self-supervised learning method for unsupervised fine-grained image hashing. In 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 17648–17657. IEEE, 2024. 3
[23] Jin Hu, Mingjia Li, and Xiaojie Guo. Shadowhack: Hack-ing shadows via luminance-color divide and conquer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 11403–11413, 2025. 1
[24] Shilin Hu, Hieu Le, ShahRukh Athar, Sagnik Das, and Dimitris Samaras. Shadow removal refinement via material-consistent shadow edges. In 2025 IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 2631–2641. IEEE, 2025. 8
[25] Xiaowei Hu, Lei Zhu, Chi-Wing Fu, Jing Qin, and Pheng-Ann Heng. Direction-aware spatial context features for shadow detection. In CVPR, pages 7454–7462, 2018. 2
[26] Xiaowei Hu, Yitong Jiang, Chi-Wing Fu, and Pheng-Ann Heng. Mask-shadowgan: Learning to remove shadows from unpaired data. In ICCV, pages 2472–2481, 2019. 1, 2, 4, 5, 6, 8
[27] Xiaowei Hu, Zhenghao Xing, Tianyu Wang, Chi-Wing Fu, and Pheng-Ann Heng. Unveiling deep shadows: A survey and benchmark on image and video shadow detection, removal, and generation in the deep learning era. International Journal of Computer Vision (IJCV), 2026. 1, 2
[28] Yeying Jin, Aashish Sharma, and Robby T Tan. Dc-shadownet: Single-image hard and soft shadow removal using unsupervised domain-classifier guided network. In ICCV, pages 5027–5036, 2021. 1, 2, 4, 5, 6
[29] Yeying Jin, Wei Ye, Wenhan Yang, Yuan Yuan, and Robby T Tan. Des3: Adaptive attention-driven self and soft shadow removal using vit similarity. In AAAI, pages 2634–2642, 2024. 2, 1
[30] Cláudio Rosito Jung. Efficient background subtraction and shadow removal for monochromatic video sequences. IEEE Transactions on Multimedia, 11(3):571–577, 2009. 1
[31] Animesh Kar and Kaushik Deb. Moving cast shadow detection and removal from video based on hsv color space. In 2015 International Conference on Electrical Engineering and Information Communication Technology (ICEE-ICT), pages 1–6. IEEE, 2015. 2, 8
[32] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 4
[33] Alexander Kirillov, Eric Mintun, Nikhila Ravi, Hanzi Mao, Chloe Rolland, Laura Gustafson, Tete Xiao, Spencer Whitehead, Alexander C Berg, Wan-Yen Lo, et al. Segment anything. In 2023 IEEE/CVF international conference on computer vision (ICCV), pages 3992–4003. IEEE, 2023. 8
[34] Nikolina Kubiak, Armin Mustafa, Graeme Phillipson, Stephen Jolly, and Simon Hadfield. S3r-net: A single-stage approach to self-supervised shadow removal. In 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pages 5898–5908. IEEE, 2024. 2, 5, 6
[35] Hieu Le and Dimitris Samaras. Shadow removal via shadow image decomposition. In ICCV, pages 8578–8587, 2019. 2, 5, 6, 7, 8, 1, 11
[36] Hieu Le and Dimitris Samaras. From shadow segmentation to shadow removal. In ECCV, pages 264–281. Springer, 2020. 1, 2, 5, 6, 7, 8, 10
[37] Hieu Le and Dimitris Samaras. Physics-based shadow image decomposition for shadow removal. IEEE Transactions on Pattern Analysis and Machine Intelligence, 44(12):9088–9101, 2021. 1
[38] Tao Lin, Qingwang Wang, Qiwei Liang, Minghua Tang, and Yuxuan Sun. Fasr-net: Unsupervised shadow removal leveraging inherent frequency priors. arXiv preprint arXiv:2504.05779, 2025. 2, 5, 6
[39] Jiawei Liu, Qiang Wang, Huijie Fan, Wentao Li, Liangqiong Qu, and Yandong Tang. A decoupled multi-task network for shadow removal. IEEE Transactions on Multimedia, 25: 9449–9463, 2023. 2
[40] Jiawei Liu, Qiang Wang, Huijie Fan, Jiandong Tian, and Yandong Tang. A shadow imaging bilinear model and three-branch residual network for shadow removal. IEEE Transactions on Neural Networks and Learning Systems, 2023. 1
[41] Yuhao Liu, Zhanghan Ke, Ke Xu, Fang Liu, Zhenwei Wang, and Rynson WH Lau. Recasting regional lighting for shadow removal. In AAAI, pages 3810–3818, 2024. 1
[42] Zhihao Liu, Hui Yin, Yang Mi, Mengyang Pu, and Song Wang. Shadow removal by a lightness-guided network with training on unpaired data. IEEE Transactions on Image Processing, 30:1853–1865, 2021. 1, 2, 5, 6, 8, 4
[43] Zhihao Liu, Hui Yin, Xinyi Wu, Zhenyao Wu, Yang Mi, and Song Wang. From shadow generation to shadow removal. In CVPR, pages 4927–4936, 2021. 1, 2, 4, 5, 6, 8
[44] Stuart Lloyd. Least squares quantization in pcm. IEEE transactions on information theory, 28(2):129–137, 1982. 4
[45] Jinting Luo, Ru Li, Chengzhi Jiang, Xiaoming Zhang, Mingyan Han, Ting Jiang, Haoqiang Fan, and Shuaicheng Liu. Diff-shadow: Global-guided diffusion model for shadow removal. In AAAI, pages 5856–5864, 2025. 2
[46] Kangfu Mei, Luis Figueroa, Zhe Lin, Zhihong Ding, Scott Cohen, and Vishal M Patel. Latent feature-guided diffusion models for shadow removal. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 4313–4322, 2024. 2
[47] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. pages 8024–8035, 2019. 4
[48] Fabian Pedregosa, Gaël Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, et al. Scikit-learn: Machine learning in python. the Journal of machine Learning research, 12:2825–2830, 2011. 3
[49] Liangqiong Qu, Jiandong Tian, Shengfeng He, Yandong Tang, and Rynson WH Lau. Deshadownet: A multi-context embedding deep network for shadow removal. In CVPR, pages 4067–4075, 2017. 2, 5, 6, 7, 8, 11
[50] Andres Sanin, Conrad Sanderson, and Brian C Lovell. Improved shadow removal for robust person tracking in surveillance scenarios. In 2010 20th International Conference on Pattern Recognition, pages 141–144. IEEE, 2010. 1
[51] Oriane Siméoni, Huy V Vo, Maximilian Seitzer, Federico Baldassarre, Maxime Oquab, Cijo Jose, Vasil Khalidov, Marc Szafraniec, Seungeun Yi, Michaël Ramamonjisoa, et al. Dinov3. arXiv preprint arXiv:2508.10104, 2025. 6, 1
[52] Emanuel Arnal Storey, Douglas Alan Stow, and Matthew James Plummer. Normalizing shadows in multi-temporal aerial frame imagery using relative radiometric adjustments to support near-real-time change detection. GIScience & Remote Sensing, 56(1):22–42, 2019. 1
[53] Florin-Alexandru Vasluianu, Tim Seizinger, and Radu Timofte. Wsrd: A novel benchmark for high resolution image shadow removal. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1826–1835, 2023. 5
[54] Florin-Alexandru Vasluianu, Tim Seizinger, Zhuyun Zhou, Zongwei Wu, Cailian Chen, Radu Timofte, Wei Dong, Han Zhou, Yuqiong Tian, Jun Chen, et al. Ntire 2024 image shadow removal challenge report. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6547–6570, 2024. 5, 6
[55] Tomás F Yago Vicente, Le Hou, Chen-Ping Yu, Minh Hoai, and Dimitris Samaras. Large-scale training of shadow detectors with noisily-annotated shadow examples. In European conference on computer vision, pages 816–832. Springer, 2016. 7, 9
[56] Tomas F Yago Vicente, Minh Hoai, and Dimitris Samaras. Leave-one-out kernel optimization for shadow detection and removal. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(3):682–695, 2017. 2
[57] Jin Wan, Hui Yin, Zhenyao Wu, Xinyi Wu, Yanting Liu, and Song Wang. Style-guided shadow removal. In ECCV, pages 361–378. Springer, 2022. 2
[58] Jifeng Wang, Xiang Li, and Jian Yang. Stacked conditional generative adversarial networks for jointly learning shadow detection and shadow removal. In CVPR, pages 1788–1797, 2018. 2, 5, 6, 7, 1, 11
[59] Xinrui Wang, Lancing Guo, Xiyu Wang, Siyu Huang, and Bihan Wen. Softshadow: Leveraging soft masks for penumbra-aware shadow removal. In CVPR, pages 23217–23226, 2025. 1
[60] Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE transactions on image processing, 13(4):600–612, 2004. 5
[61] Jie Xiao, Xueyang Fu, Yurui Zhu, Dong Li, Jie Huang, Kai Zhu, and Zheng-Jun Zha. Homoformer: Homogenized transformer for image shadow removal. In CVPR, pages 25617–25626, 2024. 2, 5, 6
[62] Jiamin Xu, Zelong Li, Yuxin Zheng, Chenyu Huang, Renshu Gu, Weiwei Xu, and Gang Xu. Omnisr: Shadow removal under direct and indirect lighting. In AAAI, pages 8887–8895, 2025. 1, 5, 6, 3
[63] Jiamin Xu, Yuxin Zheng, Zelong Li, Chi Wang, Renshu Gu, Weiwei Xu, and Gang Xu. Detail-preserving latent diffusion for stable shadow removal. In CVPR, pages 7592–7602, 2025. 2
[64] Mehmet Kerim Yücel, Valia Dimaridou, Bruno Manganelli, Mete Ozay, Anastasios Drosou, and Albert Saa-Garriga. Lra&ldra: Rethinking residual predictions for efficient shadow detection and removal. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 4925–4935, 2023. 1
[65] Ling Zhang, Chengjiang Long, Xiaolong Zhang, and Chunxia Xiao. Ris-gan: Explore residual and illumination with generative adversarial networks for shadow removal. In AAAI, pages 12829–12836, 2020. 2
[66] Qiang Zhang, Hongyuan Guo, Guanghe Li, Tianlu Zhang, and Qiang Jiao. Deep unsupervised shadow detection with curriculum learning and self-training. Computer Vision and Image Understanding, 248:104124, 2024. 2, 8
[67] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In 2018 IEEE/CVF conference on computer vision and pattern recognition, pages 586–595. IEEE, 2018. 4
[68] Lei Zhu, Zijun Deng, Xiaowei Hu, Chi-Wing Fu, Xuemiao Xu, Jing Qin, and Pheng-Ann Heng. Bidirectional feature
pyramid network with recurrent attention residual modules for shadow detection. In Proceedings of the European Conference on Computer Vision (ECCV), pages 121–136, 2018. 2
[69] Yurui Zhu, Jie Huang, Xueyang Fu, Feng Zhao, Qibin Sun, and Zheng-Jun Zha. Bijective mapping network for shadow removal. In CVPR, pages 5627–5636, 2022. 2, 5, 6
[70] Yurui Zhu, Zeyu Xiao, Yanchi Fang, Xueyang Fu, Zhiwei Xiong, and Zheng-Jun Zha. Efficient model-driven network for shadow removal. In AAAI, pages 3635–3643, 2022. 2
Consistency as Regularization for Unsupervised Shadow Removal
Supplementary Material
6. Iterative blending strategy
Following Ho et al. [21], the diffusion model defines a forward process that gradually perturbs a clean image by adding Gaussian noise over steps. The transition at each step is given by:
where denotes the noise variance at step . The cumulative effect of the forward process allows to be directly sampled from as
where and .
The reverse process aims to iteratively recover from a pure Gaussian noise sample . At each step, the posterior distribution of conditioned on is expressed as
where and denote the mean and variance of the reverse Gaussian transition. The mean term can be reparameterized by the predicted noise as
This formulation provides the theoretical foundation for diffusion-based image generation and restoration models used in subsequent works.
Recent diffusion-based approaches have shown strong capability in refining illumination and texture restoration for shadow removal tasks [18]. Motivated by this, we extend our method with a diffusion-inspired formulation that interprets shadows as structured noise. We draw inspiration from the iterative denoising principle of diffusion models [21], and formulate a deterministic refinement process that progressively removes structured shadow noise over inference steps. The key idea is to apply the model iteratively over multiple steps, where each step partially updates the image toward a shadow-free state while preserving its original structure.
Formally, given a shadow image , and an intermediate estimate , the update rule at step is defined as
where denotes our pretrained shadow removal network and is the total number of inference steps.
This formulation divides the inference into gradual refinements. At each iteration, the network output replaces only a fraction of the original , effectively diffusing the illumination correction across steps. As decreases, from down to 1, the process progressively suppresses shadow artifacts while maintaining fine-grained texture and tone consistency.

(a) Input shadow images

(b) DC-ShadowNet

(c) Ours output images

(d) Ours iterative output images

(e) Ground truth
Figure 9. Qualitative comparison on the AISTD dataset [35, 58]. We compare DC-ShadowNet [28], our base model, and our iterative extension.
Following [29], a DINOv3 [51] similarity metric is employed between the intermediate keys of the input image and the output image during the reverse refinement process to select the most visually consistent result among the intermediate steps. This similarity-based selection ensures that the final output maintains both texture coherence and structural fidelity without introducing over-smoothing artifacts. In practice, we use inference steps, corresponding to approximately 12 TFLOPs including DINOv3. For reference, the state-of-the-art diffusion-based unsupervised shadow removal method of [18] requires about 61 TFLOPs. Despite being computationally lighter, inference with our iterative blending strategy achieves higher restoration quality and better illumination consistency.
Table 6. Quantitative comparison of the proposed diffusion-inspired extension with the diffusion-based unsupervised shadow removal method [18] on the AISTD dataset. The proposed extension achieves higher performance on most metrics while requiring lower computational cost (12 TFLOPs vs. 61 TFLOPs).
| Method | Shadow | Non-Shadow | All | ||||||
|---|---|---|---|---|---|---|---|---|---|
| PSNR | SSIM | RMSE | PSNR | SSIM | RMSE | PSNR | SSIM | RMSE | |
| Guo et al. [18] (w/ detected mask) | 35.71 | 0.986 | 7.60 | 36.39 | 0.981 | 2.70 | 32.11 | 0.959 | 3.50 |
| Guo et al. [18] (w/ GT mask) | 35.91 | 0.986 | 7.60 | 37.27 | 0.984 | 2.40 | 32.73 | 0.962 | 3.30 |
| Ours | 37.47 | 0.989 | 5.86 | 36.96 | 0.984 | 2.64 | 33.35 | 0.964 | 3.13 |
| Ours k = 1 | 37.18 | 0.988 | 6.08 | 36.84 | 0.983 | 2.70 | 33.12 | 0.963 | 3.24 |
| Ours k = 2 | 36.91 | 0.987 | 6.31 | 36.69 | 0.982 | 2.77 | 32.93 | 0.962 | 3.36 |
| Ours k = 3 | 36.67 | 0.986 | 6.55 | 36.56 | 0.981 | 2.84 | 32.74 | 0.961 | 3.47 |
| Ours k = 4 | 36.45 | 0.985 | 6.79 | 36.43 | 0.981 | 2.91 | 32.58 | 0.960 | 3.58 |
| Ours | 36.98 | 0.987 | 6.22 | 36.73 | 0.982 | 2.75 | 33.00 | 0.962 | 3.31 |
| Ours TTA mean-ensemble | 37.69 | 0.990 | 5.62 | 37.04 | 0.984 | 2.57 | 33.52 | 0.966 | 3.01 |
| Ours TTA med-ensemble | 37.81 | 0.990 | 5.48 | 37.08 | 0.984 | 2.51 | 33.63 | 0.967 | 2.93 |
| Ours iterative | 38.94 | 0.992 | 5.11 | 37.12 | 0.985 | 2.40 | 34.23 | 0.972 | 2.50 |
As shown in Fig. 9, we provide a qualitative comparison between our iterative blending strategy and our base model without diffusion refinement. Since the only existing diffusion-based unsupervised shadow removal method [18] does not release source code or output images, we include DC-ShadowNet [28] as an additional reference for visual comparison. The results clearly show that the diffusion-based extension yields cleaner illumination recovery and fewer residual artifacts, particularly in regions with complex shadow boundaries.
Quantitative results are summarized in Tab. 6, where the proposed diffusion-inspired extension achieves superior performance compared with prior diffusion-based approaches, confirming the effectiveness of iterative deterministic refinement for unsupervised shadow removal. Here, k denotes the number of direct refinement steps applied to the input image before the final output. For TTA, we use five test-time augmentations, including the original image, flipped, and rotated variants, and aggregate the restored outputs by mean or median ensembling.
7. Contrastive loss weight analysis
In this section, we analyze the effect of the stop-gradient confidence weighting used in the global contrastive loss. For simplicity, we consider the loss associated with an anchor feature . All features are -normalized. Let
where is the positive pair and denotes the stop-gradient operation.
The contrastive loss for sample i is
For compactness, we denote the denominator by
and define the corresponding softmax probabilities as
Since is detached from the computational graph, it is treated as a constant during backpropagation. The gradient with respect to the anchor feature is therefore
Let the gradient of the standard unweighted contrastive loss be
Then the proposed weighted loss satisfies
Consequently,
Thus, compared with the standard contrastive objective, the proposed confidence term scales the gradient by exactly . Since
pairs with low cosine similarity receive a smaller update, whereas more confident positive pairs receive a larger contribution to representation learning.
The same behavior can be seen directly from the positive-pair component. The gradient with respect to contributed by the positive term is
Hence, a gradient-descent update with learning rate gives
Therefore, acts as an explicit confidence multiplier on the attraction between the positive pair. Similarly, the negative terms are scaled by the same confidence factor:
The stop-gradient weighting controls the gradient magnitude defined by the contrastive objective. For two samples a and b with
their confidence multipliers satisfy
Thus, relative to their corresponding unweighted contrastive gradients, sample receives a stronger update than sample . In particular, when , the contribution of an unreliable pair approaches zero, whereas when , its contribution approaches twice that of the standard contrastive objective.
This behavior is desirable for self-refining grouping. During early training, potentially incorrect pseudo-group assignments are expected to produce less consistent positive features and therefore receive smaller weights. As the representation and pseudo groups improve, positive similarities increase and these reliable pairs contribute more strongly to contrastive learning. The weighting consequently reduces the influence of uncertain assignments while preserving the attraction-repulsion behavior of the original contrastive objective.
The same analysis directly applies to the patch-wise correspondence loss , where the confidence is defined from the cosine similarity between a patch and its selected positive correspondence. Therefore, uncertain local correspondences are similarly updated more conservatively, while reliable correspondences receive stronger supervision.
8. Additional results
In this section, we provide additional qualitative results to further illustrate the behavior of our model.

(a) Input
(b) Shadow mask
(c) Guo et al.
(d) Ours
(e) GT
Figure 10. Comparison on the ISTD dataset. Images are extracted from the original paper by Guo et al. [18].

Input shadow images
Ours output images
Ground truth
Figure 11. Qualitative comparison on the INS dataset [62].
In Fig. 10 we illustrate the qualitative comparison of our method with Guo et al. [18] on the ISTD dataset using images extracted from their original paper. In Fig. 11 we show additional qualitative results of ShadowCLR on the INS dataset [62]. The INS dataset is a synthetic benchmark designed for large-scale shadow removal evaluation, while WSRD+ originates from the NTIRE 2024 Shadow Removal Challenge and contains diverse real-world scenes with complex illumination conditions.
As discussed in Sec. 3.1, the hyperparameter s controls the strength of the sigmoid gating and directly affects the degree of brightness adjustment. Since an overly small or

Figure 12. PSNR and RMSE of ShadowCLR with varying s.
large s may lead to under-correction or over-enhancement, we analyze its impact in Fig. 12. The results show that the performance varies moderately across a wide range of s, with stable PSNR and RMSE trends, indicating that the proposed framework is not overly sensitive to this parameter while still benefiting from proper calibration.
Table 7. Clustering ablation study on SRD and AISTD. We report PSNR and SSIM for shadow removal performance, and ARI for clustering quality. The best results are in bold, and the second best are underlined.
| Method | SRD | AISTD | ||||
|---|---|---|---|---|---|---|
| PSNR | SSIM | PSNR | SSIM | ARI init | ARI end | |
| Input | 18.25 | 0.837 | 20.46 | 0.894 | - | - |
| Ours KMeans (k=500) | 30.10 | 0.947 | 30.35 | 0.949 | 0.34 | 0.36 |
| Ours KMeans (k=200) | 31.38 | 0.954 | 32.42 | 0.957 | 0.64 | 0.70 |
| Ours KMeans (k=100) | 31.55 | 0.955 | 32.85 | 0.959 | 0.75 | 0.82 |
| Ours KMeans (k=50) | 29.20 | 0.946 | 32.05 | 0.956 | 0.48 | 0.65 |
| Ours DBSCAN (min_samples=1) | 32.13 | 0.960 | 33.21 | 0.965 | 0.40 | 0.96 |
| Ours DBSCAN (min_samples=4) | 32.07 | 0.959 | 34.24 | 0.964 | 0.40 | 0.94 |
| Ours DBSCAN (min_samples=8) | 28.55 | 0.946 | 30.75 | 0.951 | 0.40 | 0.42 |
| Ours AP 20% | 31.75 | 0.959 | 33.86 | 0.965 | 0.57 | 0.92 |
| Ours AP 10% | 31.98 | 0.959 | 34.16 | 0.964 | 0.53 | 0.91 |
| Ours AP 5% | 31.23 | 0.955 | 32.60 | 0.960 | 0.39 | 0.88 |
| Ours AP 1% | 30.89 | 0.950 | 31.03 | 0.952 | 0.21 | 0.48 |
| Ours | 31.93 | 0.958 | 33.35 | 0.964 | 0.59 | 0.92 |
Since our framework relies on image grouping, we further evaluate its sensitivity to the clustering strategy in Table 7. We replace Affinity Propagation with KMeans [44], using settings from a minimum of 50 to a maximum of 500 clusters, and DBSCAN [10], with the minimum number of samples ranging from 1 to 8. The results show that grouping quality affects the output image quality, but overall the method remains applicable. KMeans and DBSCAN also depend on prior knowledge of the group structure through their clustering parameters, whereas AP does not require such information and is therefore more reliable when the group structure is unknown. For large-scale datasets, computing all pairwise similarities may become expensive. Following [8] for large-scale settings, clustering can instead be fitted on a small randomly sampled subset of the train-
ing set, and the resulting cluster model can then be used to assign the remaining training samples. To evaluate our method under this setting, we fit AP using only 1%, 5%, 10%, and 20% of the training data and assign the remaining images using the learned exemplars. Using 10–20% of the training data yields performance close to that obtained with full-data AP, whereas using smaller subsets degrades performance as expected due to the very limited number of exemplars.
Table 8. Computational efficiency comparison of the proposed method with prior unsupervised shadow removal methods.
| Methods | TFLOPS | Params (M) |
|---|---|---|
| Mask-ShadowGAN | 0.05 | 22.8 |
| LG-ShadowNet [42] | 0.03 | 5.7 |
| DC-ShadowNet [28] | 0.05 | 10.6 |
| G2R | 0.11 | 22.8 |
| Guo et al. | 61 | 113.7 |
| ShadowCLR (Ours) | 0.05 | 11.4 |
| ShadowCLR (Ours) iterative | 12 | 11.4 |
Table 9. Ablation study of the reconstruction loss with different values of and .
| Method | AISTD | SRD | ||
|---|---|---|---|---|
| PSNR | SSIM | PSNR | SSIM | |
| Ours () | 32.98 | 0.960 | 29.12 | 0.914 |
| Ours () | 31.15 | 0.954 | 29.88 | 0.933 |
| Ours () | 33.06 | 0.963 | 30.06 | 0.920 |
| Ours () | 32.82 | 0.964 | 30.23 | 0.915 |
| Ours () | 33.87 | 0.972 | 31.28 | 0.954 |
| Ours () | 34.18 | 0.971 | 30.78 | 0.950 |
| Ours () | 34.08 | 0.972 | 31.01 | 0.955 |
| Ours () | 33.35 | 0.964 | 31.93 | 0.958 |
Table 9 further analyzes the reconstruction loss . The results show that using only the pseudo-target reconstruction is insufficient. The effect of and also depends on the dataset. On AISTD, images within the same scene are more consistent, so a stronger group-consistency term is more helpful. On SRD, illumination and target appearances vary more across grouped images, making the self-reconstruction term relatively more important for preserving image-specific content. We also compare computational efficiency with prior methods in Tab. 8. Our standard model requires 0.05 TFLOPs per image, approximately 18 images/s on a single NVIDIA H100 GPU. The iterative refinement variant requires about 12 TFLOPs.
To further analyze the effect of shadow generation, we revisit the ablation in Table 3. When similar images are available, using or removing the shadow generator has only a limited effect, and in some metrics removing it even gives slightly better results. This can be explained by the fact that shadows directly observed in other images of the same group are more realistic than synthetically generated ones. However, the role of the shadow generator becomes clearer when similar images are unavailable. We repeat the one-image-per-group setting without shadow generation and obtain only 26.94 PSNR and 0.915 SSIM, compared with 30.62 PSNR and 0.951 SSIM when shadow generation is used. This shows that the shadow generator is an important component when training data do not provide similar observations. Interestingly, the one-image-per-group result is also close to the cross-dataset evaluation where the model is trained on SRD and tested on AISTD (30.71 PSNR and 0.949 SSIM). In both cases, the shadows used during training follow a distribution different from the shadows in AISTD, which may explain why their performance is lower than when the model is trained directly on AISTD.

Figure 13. Random groups from SRD and INS, with up to five images per group where available.
Figure 13 shows randomly selected groups from SRD and INS. The SRD groups mostly contain visually related real images with overlapping scene regions, while INS is more challenging because it is synthetically generated, contains fewer images per scene, and exhibits larger inter-image variations with often small self-shadows.
As shown in Fig. 14, our method removes shadows effectively while preserving fine reflections and illumination cues, in some cases even producing reflection consistency superior to the ground truth. This demonstrates that the model fulfills its intended objective by focusing solely on shadow removal.
In Figs. 15 to 20, we present additional qualitative results across all datasets used in this paper, covering both shadow removal and shadow segmentation. These examples show that our method performs robustly across diverse scenes, often outperforming several supervised approaches and, in certain cases, even producing results that are visually more consistent than the ground truth.

(f) Ground truth
Figure 14. Qualitative results on the AISTD dataset [35, 58]. Our model removes shadows while preserving fine reflections and illumination details, and in several cases achieves better reflection fidelity than the ground truth.

(f) Ground truth
Figure 15. Qualitative comparison on the AISTD dataset [35, 58].

(f) Ground truth
Figure 16. Qualitative comparison on the SRD dataset [49].

(a) Input shadow images
(b) Ours output mattes
(c) Ground truth masks
(d) Ours output images
Figure 17. Qualitative results of shadow segmentation on the SBU dataset [55].

(a) Input
(b) LG-ShadowNet
(c) G2R

(d) Ours
(e) Ours+
(f) GT
Figure 18. Qualitative comparison on the video shadow dataset [36].

(a) Input
(b) Ours
(c) Ours mask
(d) Ours+
(e) Ours+ mask
(f) GT
Figure 19. Qualitative results on the video shadow dataset [36].

(e) Ground truth images
Figure 20. Qualitative results of shadow segmentation on the AISTD [35, 58] and SRD [49] datasets.