A shadow detection method based on self-calibration tags and spatial constraints

By employing a shadow detection method based on self-calibrated labels and spatial constraints, and utilizing iterative confidence aggregation and spatial consistency verification mechanisms, combined with an alternating loss function, the problems of annotation noise and prediction fragmentation in shadow detection are solved, thereby improving the detection accuracy and robustness of the model in complex scenarios.

CN122347730APending Publication Date: 2026-07-07HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU DIANZI UNIV
Filing Date
2026-04-16
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Existing shadow detection methods face problems such as annotation noise and prediction fragmentation in complex scenes, resulting in insufficient detection accuracy and robustness of the model under extreme conditions.

Method used

We employ a self-calibrated label and spatial constraint-based approach, using iterative confidence aggregation (ICA) and spatial consistency verification (SCV) mechanisms, combined with an alternating loss function (ALF) strategy, to dynamically adjust pixel weights and spatial consistency constraints, thereby improving the robustness and boundary consistency of the model.

Benefits of technology

It significantly improves the accuracy and robustness of shadow detection, especially in complex textures and blurred boundary scenes, reducing boundary localization bias and prediction holes, and enhancing the model's generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122347730A_ABST
    Figure CN122347730A_ABST
Patent Text Reader

Abstract

The application discloses a shadow detection method based on a self-calibration label and space constraint. A shadow detection network SDDNet is used to forward propagate an input image, extract shadow-related features and background / style-related features, and output a shadow probability map; in combination with SDDNet baseline training, an iterative confidence aggregation ICA mechanism, a space consistency verification SCV mechanism and an alternating loss function ALF strategy, the training of a shadow detection network model is carried out on a pretreated data set. By introducing the ICA and SCV mechanisms, the application solves the problem of inaccurate supervision signals caused by poor labeling quality and fuzzy soft shadow boundary, and the problems of prediction holes and sawteeth caused by complex texture regions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and image processing, specifically relating to a shadow detection method based on self-calibrated labels and spatial constraints. This method effectively addresses the problems of annotation noise and prediction fragmentation faced by existing shadow detection methods in complex scenes by introducing iterative confidence aggregation (ICA), spatial consistency verification (SCV), and alternating loss functions (ALF) strategies, thereby improving the accuracy and robustness of shadow detection. Background Technology

[0002] Shadows are a ubiquitous optical phenomenon in nature, formed by objects blocking light sources. They are a crucial prerequisite for tasks such as scene understanding, object tracking, and image reconstruction in computer vision. On the one hand, the presence of shadows can lead to the loss or confusion of feature information in tasks like object detection and instance segmentation, reducing the accuracy and robustness of algorithms. On the other hand, shadows themselves contain rich scene information, such as the geometry of objects and the position and direction of light sources. Accurately detecting and analyzing shadows helps enhance scene understanding capabilities. Therefore, accurate and efficient shadow detection has become an important and challenging fundamental task in the field of computer vision.

[0003] Early shadow detection research was largely based on explicit physical modeling and handcrafted feature construction. Common methods included: physically optical modeling methods that rely on illumination variation models; color space invariance methods that look for invariance cues in specific color spaces; boundary recognition methods based on brightness gradient variations; texture distribution methods that utilize texture properties; and edge alignment methods based on edge geometry. These methods perform well in controlled environments, but their generalization ability is weak when faced with complex and varied lighting and non-uniform backgrounds in the real world.

[0004] With breakthroughs in deep learning technology, Convolutional Neural Networks (CNNs) have become the mainstream paradigm for shadow detection due to their superior multi-scale feature extraction capabilities. These methods can automatically learn richer and more discriminative hierarchical feature representations from large-scale data, effectively improving detection accuracy under complex lighting and background conditions. Researchers have proposed various structural improvement strategies, including BDRAR, which captures the structural dependencies of shadows through multi-scale context modeling and bidirectional feature pyramids; attention-guided mechanisms, which enhance the model's focus on key features by introducing attention modules; adversarial learning, which uses generative adversarial networks to improve the robustness of shadow detection; orientation-aware characteristics, which improve detection performance by analyzing the directional features of shadows; semi-supervised training mechanisms such as MTMT-Net, which introduce unlabeled data for consistency constraints using a multi-task mean teacher framework; and feature decoupling methods such as SDDNet, which decompose input image features into shadow-related features and background / style-related features, thereby suppressing background interference at the representation level.

[0005] In recent years, the Transformer architecture has achieved remarkable success in image classification and semantic segmentation due to its powerful global context modeling capabilities. Its applications in shadow detection mainly include embedding it as a feature enhancement module into the CNN backbone network to improve the accuracy of global perception; constructing pure Transformer or hybrid architectures, such as variants based on SETR, SegFormer, or MPViT, to fuse multi-level features using multi-path mechanisms; and exploring the transfer of basic models such as the Segment Anything Model (SAM) to shadow detection tasks.

[0006] Noise label learning aims to mitigate the negative impact of erroneous supervisory signals on model training. In image recognition, DivideMix utilizes a semi-supervised framework to divide samples into clean and noisy subsets, achieving label correction through collaborative learning; NCR leverages the topological structure of the feature space to smooth out noise effects by constraining the consistency among nearest-neighbor samples. With the development of generative techniques, LRA-Diffusion models label recovery as a stochastic denoising process based on a diffusion model. For dense prediction image segmentation tasks, IUR-Net proposes a progressive three-stage framework that accurately locates and locally corrects label conflicts in remote sensing images using the Ms-EALM module.

[0007] Despite significant progress in deep learning-based methods, several challenges remain when handling extremely complex scenes. First, the unreliability of supervisory signals limits the learning ceiling of the model. Existing shadow detection datasets suffer from significant noise in their labels due to the inherent ambiguity of soft shadow boundaries and subjective biases in manual annotation. Traditional strongly supervised training forces the model to fit these inaccurate boundaries, leading to severe boundary localization errors during testing. Second, there's the issue of prediction fragmentation in complex textured backgrounds. When shadows cover areas with high-frequency textures or drastic color changes, the model often struggles to maintain spatial continuity in the predictions, resulting in "holes" within the shadows or jagged edges. This not only affects visual quality but also undermines the integrity of the shadow as a semantic entity. Third, there are limitations in existing LNL research. Current noisy labeling research often focuses on class misflipping, neglecting spatial localization inaccuracies and boundary drift characteristics when handling segmentation tasks. More importantly, existing methods based on the "small loss criterion" are prone to failure in shadow tasks because pixels in soft shadow regions naturally have high loss values ​​and are often misclassified as noise and discarded, causing the model to fail to capture natural gradation details. To address these issues, this invention proposes a shadow detection method based on self-calibrated labels and spatial constraints. Through dynamic weight allocation and spatial consistency constraints, the accuracy and boundary consistency of shadow detection are significantly improved. Summary of the Invention

[0008] To address the shortcomings of existing technologies, this invention provides a shadow detection method based on self-calibrated labels and spatial constraints. By introducing iterative confidence aggregation (ICA) and spatial consistency verification (SCV) mechanisms, it solves the problems of inaccurate supervision signals caused by poor label quality and blurred soft shadow boundaries, as well as prediction holes and jagged edges caused by complex texture regions.

[0009] A shadow detection method based on self-calibrated labels and spatial constraints includes the following steps:

[0010] Step 1: Perform data preprocessing on the shadow detection data.

[0011] Step 2: Perform forward propagation on the input image using the shadow detection network SDDNet to extract shadow-related features and background / style-related features, and output a shadow probability map.

[0012] Step 3: Aggregate historical predictions from the time dimension using the Iterative Confidence Aggregation (ICA) mechanism to form a pixel-level "confidence" estimate. Based on this, assign full supervisory weights to high-confidence pixels and reduced supervisory weights to low-confidence / uncertain pixels. It adaptively adjusts the contribution of each pixel in the loss calculation. Unlike existing static partitioning strategies, ICA uses the exponential moving average (EMA) technique to accumulate the model's historical predictions over time, which can automatically identify the physical consistency of soft shadow transitions and accurately distinguish between "difficult but correct" transition pixels and "real annotation noise".

[0013] Step 4: The Spatial Consistency Verification (SCV) mechanism is used to evaluate the structural consistency between the predicted mask and the ground truth label in the local block neighborhood of the shadow detection network from a spatial dimension, suppressing unstable gradients caused by local cluttered boundaries and fragmented noise. When the local boundary structure of the prediction and label is consistent, high supervision weights are given; when the two are significantly inconsistent, the weights are reduced to avoid the model overfitting to potential noisy labels.

[0014] Step 5: Based on the Alternating Loss Function (ALF) strategy, the optimization alternates between "maintaining decoupled stability" and "strengthening reliable supervision" to avoid the shadow detection network from over-relying on weighted terms and thus violating structural constraints. By periodically forcing the model to re-face the low-weight regions, overfitting of the model to adaptive weights is effectively prevented.

[0015] Step 6: Combine SDDNet baseline training, ICA mechanism, SCV mechanism and ALF strategy to train the shadow detection network model on the preprocessed dataset.

[0016] The beneficial effects of this invention are as follows:

[0017] The ICA mechanism of this invention effectively mitigates the negative impact of inaccurate supervision signals. By dynamically reducing the weight of uncertain pixels, it forces the model to shift from rote memorization of inaccurate labels to robust learning based on physical features, significantly enhancing the model's generalization upper limit while maintaining edge coherence. The SCV mechanism significantly improves the internal fullness and edge smoothness of shadow regions. By constraining the structural consistency between model predictions and ground truth annotations in local regions, it effectively identifies noisy regions and reduces their supervision weights, enhancing the model's structural coherence and accuracy in shadow boundary regions. The ALF strategy balances the learning intensity of simple and difficult samples by periodically switching the loss function, improving training efficiency while enhancing generalization ability and effectively preventing overfitting of the model to adaptive weights. Experimental results show that the method of this invention achieves leading performance on multiple public datasets, effectively demonstrating its robustness in handling blurred boundaries and complex textures. In particular, on the most challenging UCF dataset, the BER is reduced by 5.92% compared to the SDDNet baseline, indicating that the method of this invention has strong generalization ability and exhibits excellent robustness in handling complex and variable scenes. Attached Figure Description

[0018] Figure 1 This is an overall structural diagram of the method in the embodiments of the present invention.

[0019] Figure 2 This is a schematic diagram of the Iterative Confidence Aggregation (ICA) mechanism in an embodiment of the present invention.

[0020] Figure 3 This is a schematic diagram of the Spatial Consistency Verification (SCV) mechanism in an embodiment of the present invention.

[0021] Figure 4 This is a graph showing the qualitative comparison results between the embodiments of the present invention and existing methods.

[0022] Figure 5 This is a visualization of the ablation experiment results in an embodiment of the present invention.

[0023] Figure 6 This is a result diagram of the video shadow detection application in an embodiment of the present invention. Detailed Implementation

[0024] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0025] like Figure 1As shown, this invention proposes a shadow detection method based on self-calibrated labels and spatial constraints. It uses a Style-guided Dual-layer Disentanglement Network (SDDNet) as the backbone model. The core idea is to decompose the input image features into shadow-related features and background / style-related features, thereby suppressing the interference of background color, material texture, and other factors on shadow prediction at the representation level. The method specifically includes the following steps:

[0026] Step 1: Collect publicly available shadow detection datasets from the internet, including high-quality datasets such as SBU, ISTD, and UCF. The SBU dataset contains 4,089 training images and 638 test images, making it the largest shadow detection dataset to date; the ISTD dataset contains 1,330 training images and 540 test images, and is known for its high-precision pixel-level annotations; the UCF dataset contains 221 test images, covering complex outdoor lighting conditions.

[0027] Step 2: Perform data preprocessing on the shadow detection data. Preprocessing includes uniformly adjusting the image resolution to 416×416.

[0028] Step 3: Perform forward propagation on the input image using the shadow detection network SDDNet to extract shadow-related features and background / style-related features, and output a shadow probability map. .

[0029] The baseline training objective of the shadow detection network SDDNet consists of three parts: pixel-level binary cross-entropy loss. Used to supervise the final shadow probability map; reconstructing consistency loss. To ensure that decoupled features can still reconstruct key information while constraining structural integrity; style-aided loss. Constrained style-guided feature separation and gradient stability. Therefore, the original loss is:

[0030]

[0031] The above training process is conducted iteratively. It is important to emphasize that... and Fundamentally, it plays the role of "structural preservation / decoupling stability," and its optimization objective should not be significantly perturbed by noise weights during training. Therefore, the subsequent adaptive weighting strategy composed of ICA and SCV is only applied to... This is to prevent the core decoupling capabilities of SDDNet from being compromised.

[0032] Step 4: Design an Iterative Confidence Aggregation (ICA) mechanism to aggregate historical predictions from a time dimension and form a pixel-level "confidence" estimate.

[0033] The ICA mechanism accumulates historical predictions from the model using the exponential moving average (EMA) technique, enabling it to automatically identify the physical consistency of soft shading transition zones. By comparing the stability of current predictions with historical trends, it accurately distinguishes difficult but correct transition pixels from genuine labeling noise. By dynamically reducing the gradient weights of unstable pixels, it forces the model to shift from rote memorization of inaccurate labels to robust learning based on physical features.

[0034] Specifically, in the t-th iteration of training, an independent historical prediction map is maintained for each training image. Its update rules are as follows: ,in This is the shadow prediction result of the t-th iteration, where α is the smoothing coefficient (set to 0.9 in the example). This is the shadow probability map currently output by the network in the t-th iteration. For example... Figure 2 As shown, based on the maintained historical prediction graph And the true label G, all pixels in the shaded probability map predicted by the model are divided into two categories of regions according to the following rules: high confidence regions Historical prediction chart satisfy And the true label G=1, or Pixels with G=0 indicate that the pixel's predictions were stable and consistent with the label throughout the training history; low confidence / uncertain regions Historical prediction chart exist[ , The values ​​fluctuate between [0.2, 0.8] in this embodiment. Based on this, the ICA adaptive weights are defined. For pixels in high-confidence regions, the ICA adaptive weights... Set to 1.0; for pixels in low-confidence / uncertain regions, ICA adaptive weights are used. Set as a weighting factor for the low confidence region ( ∈(0,1), which is set to 0.50 in this embodiment, thereby reducing the contribution of uncertain pixels in the loss calculation and forcing the model to focus on more reliable pixels.

[0035] Step 5: Design a Spatial Consistency Verification (SCV) mechanism to evaluate the structural consistency between the predicted mask and the true annotation of the shadow detection network output in the local block neighborhood from a spatial dimension, and suppress unstable gradients caused by local cluttered boundaries and fragmented noise.

[0036] The SCV mechanism first calculates the model's predicted probability. Figure 2The predicted mask is obtained by quantization. Then, boundary structure analysis of 2×2 image patches and 4×4 neighborhoods is performed on both the predicted and ground truth labeled masks. The reliability of the labeling in a region is determined by comparing the difference in the number of boundary patches in the local neighborhood between the predicted and labeled masks. When the boundary structures of the two are consistent, a high supervision weight is given; when the difference exceeds the tolerance threshold, the supervision weight is reduced.

[0037] Specifically, the predicted shadow probability map is first binarized with a threshold of 0.5 to obtain the prediction mask. Then, block-level boundary structure analysis is performed on both the prediction mask and the ground truth label mask. This analysis is applied to any 2×2 image block in both the prediction mask and the ground truth label mask. Where i,j are the row and column indices of the 2×2 block in the mask, and an indicator function is defined. If an image patch contains both 0s and 1s (a mixture of shadowed and unshadowed pixels), then the current image patch is determined to be a boundary patch. =1, otherwise 0. Further, slide the mask with a step size of 2, taking one 2x2 block as the center block each time. subscript The sliding index of the center block (i.e., the first) (a central block), for the central block), The minimum bounded 4×4 region, i.e. the local neighborhood, is constructed around the core, and four adjacent 2×2 image patches are selected from its four corners. (Top left, top right, bottom left, bottom right), and count the number of boundary blocks for both the predicted mask and the actual label mask: ,in and They represent the first Each central block corresponds to the number of boundary blocks in the predicted mask and the real label mask within their local neighborhood. Based on... The difference in the value of defines the spatial consistency weight for the central block. This weight is applied when the difference between the predicted and labeled boundary block counts does not exceed a tolerance threshold. When the difference exceeds 1.0, give it a full weight of 1.0; when the difference exceeds 1.0, give it a full weight of 1.0. When, reduce the weight to The specific formula is as follows:

[0038]

[0039] The core idea of ​​this design is to calculate the number of boundary blocks in the local neighborhood of both the predicted mask and the ground truth label mask, and then compare the differences between them. When the model prediction and the ground truth label exhibit similar boundary structures in the local region, it indicates that the label in that region is reliable, and high supervision weights are given. When the local structure patterns of the two are significantly different (the difference exceeds the tolerance threshold ε), it indicates that there may be labeling noise or model confusion in that region, and the supervision weights are reduced to prevent the model from overfitting to potentially incorrect labels. Finally, a spatial consistency weight is defined for each pixel (x, y):

[0040]

[0041] in In pixels This represents a 2×2 image block in the top left corner. This allows block-level consistency information to be mapped to pixel-level weighting, achieving an adaptive transfer "from local structural confidence to supervision strength".

[0042] Step 6: Design an alternating loss function (ALF) strategy to alternate between "maintaining decoupled stability" and "enhancing reliable supervision".

[0043] The ALF strategy periodically switches between the original loss and the weighted loss. Even-numbered periods use the original loss to emphasize robust decoupling and reconstruction constraints, while odd-numbered periods use the weighted loss to emphasize discriminative learning oriented towards reliable supervision, thus enhancing generalization ability as a strong regularization method. The dual constraints of ICA and SCV work synergistically: ICA addresses the issue of reliable labeling, while SCV addresses the issue of spatial robustness. Their complementarity achieves synergistic optimization of temporal stability and spatial consistency constraints.

[0044] Specifically, ICA and SCV evaluate the supervision reliability from two complementary paths, time and space, respectively, and construct composite weights using multiplicative fusion:

[0045]

[0046] Subsequently, only Apply to binary classification items ,Keep and This remains unchanged, thus achieving a balance between supervised denoising and decoupling stability. The weighted loss is defined as:

[0047]

[0048] This "gating" design means that a pixel can only receive significant supervised weights if it simultaneously exhibits temporal stability and spatial consistency; uncertainty in either dimension will suppress its gradient contribution. First, perform... Wheel preheating (in this embodiment) =5), using the original loss during the preheating stage. Training is performed to establish a stable feature decoupled representation for the model. After warm-up, an adaptive weighting mechanism is introduced, and the original loss and weighted loss are used alternately periodically in subsequent training with each epoch as a cycle (P=1).

[0049]

[0050] Step 7: Combine the SDDNet baseline training, ICA mechanism, SCV mechanism and ALF strategy described in steps 3 to 6 to train the model on the preprocessed dataset.

[0051] The Adam optimizer was used, with a batch size of 4. The model was trained for a total of 50 epochs with an initial learning rate of 0.0005 and a Poly learning rate decay strategy with a decay rate of 0.7. All input images were uniformly adjusted to a resolution of 416×416.

[0052] Step 8: Validate the saved optimal model weights on the test set. Use the balanced error rate (BER) as the main evaluation metric to evaluate the recognition performance in shaded and unshaded regions separately.

[0053] Quantitative comparison with existing methods

[0054] This invention quantitatively compares the proposed method (SDDNet+ICA+SCV+ALF) with shadow detection methods that have performed well on datasets such as SBU, ISTD, and UCF in recent years. The comparison methods include, but are not limited to: Unary-Pairwise, stacked-CNN, scGAN, ST-CGAN, A+D Net, BDRAR, DSDNet, DSC, ECA, RCMPNet, FDRNet, CM-Net, SegNeXt, SegFormer, R2D, MTMT-Net, TransShadow, SILT, and SDDNet, all of which yield results from published papers.

[0055] Table 1. Quantitative comparison with the SOTA method on the SBU, ISTD, and UCF datasets.

[0056]

[0057] Ablation Experiments and Analysis

[0058] To verify the effectiveness of the proposed Iterative Confidence Aggregation (ICA), Spatial Consistency Verification (SCV), and Alternating Loss Function (ALF) strategies, a series of detailed ablation experiments were designed. All experiments were conducted on the SBU and ISTD datasets based on the SDDNet baseline model, and BER was used as the core metric for quantitative evaluation.

[0059] Table 2 Ablation Experiment Results (SBU and ISTD Datasets)

[0060]

[0061] Detailed analysis of ablation test results

[0062] Table 2 provides a detailed analysis of the contributions of each component. The contribution of the ICA mechanism is evident in the significant improvement in model performance after its independent introduction. The BER on the SBU test set decreased to 2.84 (an improvement of 3.40%), and the BER on the ISTD test set decreased to 1.23 (an improvement of 3.14%). This demonstrates that ICA, through time-cumulative prediction, effectively identifies and reduces the weighting of blurred label noise and unstable pixel predictions, proving the effectiveness of improving label reliability through historical information for shadow detection.

[0063] The contribution of the SCV mechanism is reflected in the fact that introducing the SCV mechanism alone brings a more significant performance improvement, with the BER on the SBU test set decreasing to 2.82 (an improvement of 4.08%) and the BER on the ISTD test set decreasing to 1.22 (an improvement of 3.93%). This shows that SCV, through spatial cross-validation, successfully penalizes spatial inconsistencies caused by local noise or complex textures, greatly enhancing the structural coherence and accuracy of the model in shadow boundary regions.

[0064] The synergistic effect of the dual constraints is evident in the fact that when both ICA and SCV mechanisms are introduced simultaneously, the BER of the SBU test set decreases to 2.74 (an improvement of 6.80%), and the BER of the ISTD test set decreases to 1.18 (an improvement of 7.08%). This synergy verifies the complementarity of temporal stability and spatial consistency constraints. ICA addresses the issue of reliable labeling, while SCV addresses the issue of spatial robustness; their complementarity achieves synergistic optimization.

[0065] The contribution of the ALF strategy is evident in the following: Building upon ICA and SCV, the introduction of the ALF strategy resulted in optimal model performance, with the BER on the SBU test set decreasing to 2.70 (an 8.16% improvement) and the BER on the ISTD test set decreasing to 1.14 (a 10.20% improvement). This demonstrates the necessity of ALF as a regularization mechanism, effectively preventing overfitting of the model to adaptive weights by periodically forcing the model to re-examine low-weight regions.

[0066] Qualitative comparison and visualization analysis

[0067] like Figure 4 As shown, a qualitative comparison is made between our method and state-of-the-art shadow detection methods. The third and fourth rows present a qualitative comparison on the UCF dataset. Even with images exhibiting significant style differences from the training set, our method maintains stable detection performance, demonstrating strong generalization ability. In the first row, our method accurately captures the gradient regions and fine shadow structures of soft shadows, with significantly better edge sharpness than other models. In the third row, despite significant differences in image contrast, our method accurately identifies shadow regions, while other methods produce noise and jagged edges. The error rate in non-shadow regions is significantly reduced, indicating that our training strategy successfully suppresses training noise caused by label uncertainty, enabling the model to more accurately distinguish non-shadow regions in complex backgrounds.

[0068] Visualized results analysis

[0069] like Figure 5 The diagram illustrates the visualization results of the training process of this invention. Compared to the baseline, the ICA+SCV+ALF method can significantly filter more reliable samples and improve the accuracy of shadow detection. The visualization results show that the ICA mechanism successfully identifies and reduces the weight of noisy label regions, allowing the model to focus on reliable supervision signals and effectively mitigating the negative impact of inaccurate supervision signals. The SCV mechanism effectively fills the holes inside the shadows and smooths the jagged edges. By evaluating the structural consistency between the model prediction and the true label in the local region, it improves the internal fullness and edge smoothness of the shadow region. The ALF strategy further improves the overall performance of the model, making the final detection results more accurate and robust.

[0070] Application Case - Video Shadow Detection

[0071] To further evaluate the generalization performance of the framework of this invention, it was applied to the ViSha video dataset for video shadow detection. The video sequence was processed frame-by-frame according to time sequence without any fine-tuning of the video data. Figure 6 The test results on this dataset are presented. Experimental results show that even in a zero-shot test scenario, this method can still generate high-precision shadow masks in real time, demonstrating excellent stability and edge consistency. This successful transfer from static distribution to dynamic video stream strongly proves that this method can accurately capture the intrinsic physical features of shadows and has extremely strong cross-domain generalization ability. The inference speed is fast, with an inference time of approximately 0.03 seconds per image, which is sufficient to handle complex and ever-changing real-world dynamic environments.

[0072] Experimental conclusions

[0073] In summary, the proposed method integrates three core mechanisms—Iterative Confidence Aggregation (ICA), Spatial Consistency Verification (SCV), and Alternating Loss Function (ALF)—to construct a collaborative spatiotemporally robust learning paradigm. The ICA mechanism utilizes temporal information during training evolution to efficiently filter label noise and calibrate weights through the dynamic accumulation of historical predictions. The SCV mechanism, based on local topological consistency priors, enhances the structural integrity and geometric accuracy of shadow edges from a spatial perspective. The ALF strategy, as a dynamic regularization method, effectively smooths the fitting bias in the adaptive weighting process by periodically switching the supervision signal, significantly improving the model's generalization upper limit. Extensive experiments on three major benchmark datasets—SBU, ISTD, and UCF—demonstrate that this invention surpasses existing state-of-the-art methods in key evaluation metrics such as BER. In particular, its outstanding performance in cross-domain testing scenarios strongly demonstrates the significant advantages of the proposed adaptive learning framework in improving the understanding of complex scenes.

[0074] The above description is merely a preferred embodiment of the present invention and does not limit the scope of protection of the present invention. It should be emphasized that any minor adjustments and improvements made by those skilled in the art without departing from the basic principles of the present invention should be considered within the scope of protection of the present invention.

Claims

1. A shadow detection method based on self-calibration labels and spatial constraints, characterized in that, Includes the following steps: Step 1: Perform data preprocessing on the shadow detection data; Step 2: Perform forward propagation on the input image using the shadow detection network SDDNet to extract shadow-related features and background / style-related features, and output a shadow probability map; Step 3: Aggregate historical predictions from the time dimension through the iterative confidence aggregation ICA mechanism to form a pixel-level "confidence" estimate, and assign full supervision weights to high-confidence pixels and reduced supervision weights to low-confidence / uncertain pixels, adaptively adjusting the contribution of each pixel in the loss calculation. Step 4: The Spatial Consistency Verification (SCV) mechanism is used to evaluate the structural consistency between the predicted mask and the real label of the shadow detection network output in the local block neighborhood from the spatial dimension, and to suppress unstable gradients caused by local cluttered boundaries and fragmented noise. Step 5: Based on the Alternating Loss Function (ALF) strategy, perform alternating optimization between "maintaining decoupling stability" and "enhancing reliable supervision"; Step 6: Combine SDDNet baseline training, ICA mechanism, SCV mechanism and ALF strategy to train the shadow detection network model on the preprocessed dataset.

2. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, The preprocessing includes uniformly adjusting the image resolution to 416×416.

3. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, The baseline training objective of the shadow detection network SDDNet consists of three parts: pixel-level binary cross-entropy loss. Used to supervise the final shadow probability map; reconstructing consistency loss. To ensure that decoupled features can still reconstruct key information while constraining structural integrity; style-aided loss. Constrained style-guided feature separation and gradient stability; therefore, the original loss is: 。 4. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, The iterative confidence aggregation (ICA) mechanism is as follows: In the t-th iteration of training, an independent historical prediction map is maintained for each training image. Its update rules are as follows: ,in This is the shadow prediction result of the t-th iteration, where α is the smoothing coefficient. It is the shadow probability map of the network's current output in the t-th iteration; based on the maintained historical prediction map. And the true label G, all pixels in the shaded probability map predicted by the model are divided into two categories of regions according to the following rules: high confidence regions, i.e., historical prediction regions. satisfy And the true label G=1, or Pixels with G=0 indicate that the pixel's predictions were stable and consistent with the label throughout the training history; low-confidence / uncertain regions represent historical prediction maps. exist[ , The values ​​fluctuate between [a certain range]; and the ICA adaptive weights are defined accordingly; for pixels in high-confidence regions, the ICA adaptive weights [are adjusted accordingly]. Set to 1.0; for pixels in low-confidence / uncertain regions, ICA adaptive weights are used. Set as a weighting factor for the low confidence region .

5. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, Spatial Consistency Verification (SCV) mechanism is as follows: First, the shadow probability map predicted by the model is binarized with a threshold of 0.5 to obtain the prediction mask. Then, block-level boundary structure analysis is performed on both the prediction mask and the ground truth label mask. For any 2×2 image block in both the prediction mask and the ground truth label mask... Where i,j are the row and column indices of the 2×2 block in the mask, and an indicator function is defined. If an image patch contains both 0 and 1, then the current image patch is determined to be a boundary patch. =1 otherwise 0; furthermore, slide on the mask with a step size of 2, and take a 2x2 block as the center block each time. subscript As the sliding index of the center block, for... The minimum bounded 4×4 region, i.e. the local neighborhood, is constructed around the core, and four adjacent 2×2 image patches are selected from its four corners. The number of boundary blocks was counted for both the predicted mask and the real label mask. ,in and They represent the first Each central block corresponds to the number of boundary blocks in the predicted mask and the real label mask within their local neighborhood; according to The difference in the value of the boundary block is used to define the spatial consistency weight for the central block; when the difference between the predicted and labeled boundary block counts does not exceed the tolerance threshold. When the difference exceeds 1.0, give it a full weight of 1.0; when the difference exceeds 1.0, give it a full weight of 1.

0. When, reduce the weight to The specific formula is as follows: Finally, a spatial consistency weight is defined for each pixel (x, y): in In pixels The top left corner is a 2×2 image block.

6. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, The Alternating Loss Function (ALF) strategy is designed as follows: ICA and SCV evaluate the reliability of supervision from two complementary paths, time and space, respectively, and construct composite weights using multiplicative fusion: Subsequently, only Apply to binary classification items ,Keep and This remains unchanged, thus achieving a balance between supervised denoising and decoupling stability; the weighted loss is defined as: First Wheel preheating, the preheating stage uses the original losses Train the model to establish a stable feature decoupled representation; After the warm-up is complete, an adaptive weighting mechanism is introduced, and in subsequent training, the original loss and weighted loss are used alternately periodically with each epoch as a cycle. 。 7. The shadow detection method based on self-calibration labels and spatial constraints according to claim 1, characterized in that, The Adam optimizer was used for training, with a batch size of 4. The model was trained for a total of 50 epochs with an initial learning rate of 0.0005 and a Poly learning rate decay strategy with a decay rate of 0.

7. All input images were uniformly adjusted to 416×416 resolution.