ShadowMaskFormer: Mask Augmented Patch Embedding for Shadow Removal

Zhuohao Li

TL;DR

This paper introduces ShadowMaskFormer, a novel transformer-based approach for shadow removal that integrates shadow mask information directly into the patch embedding stage. By doing so, it achieves state-of-the-art performance with significantly fewer parameters and computational cost compared to existing methods.

What Problem Does This Paper Address?

Shadow removal is a crucial but challenging task in computer vision, as shadows degrade image quality and negatively impact downstream applications like object detection. While transformer models have shown great promise, current shadow removal methods using transformers often rely on complex modifications within the transformer blocks themselves or generic patch embeddings that don't fully leverage shadow information. This leads to increased model complexity and computational overhead. The paper aims to address this by proposing a simpler, more efficient method that incorporates shadow information earlier in the processing pipeline.

Methods

The core innovation of ShadowMaskFormer lies in its Mask Augmented Patch Embedding (MAPE) module. Unlike previous methods that integrate shadow masks later or in more complex ways, MAPE injects shadow information right at the initial patch embedding stage. This is achieved by:

  • Dual Binarization Schemes: The shadow mask is processed using two complementary binarization techniques: a standard 0/1 mask ($M_s$) and a -1/+1 mask ($M_p$).
  • Region Reassignment: The 0/1 mask ($M_s$) is used to reassign pixel intensities, effectively emphasizing shadow regions by using a higher weight ($w_1$) compared to non-shadow regions ($w_2$). This step is designed to make the shadow region pixels more prominent.
  • Adaptive Refinement: The -1/+1 mask ($M_p$) is then used to further refine the processed image. This step helps to re-balance pixel distributions and enhance shadow region pixels, making them more similar to non-shadow regions.
  • Linear Projection: Finally, a linear projection layer transforms the refined features, which are then fed into the standard transformer blocks.

This approach allows the model to learn the necessary shadow removal characteristics early on, reducing the need for complex modifications in later transformer blocks and leading to improved efficiency.

Datasets

The paper evaluates ShadowMaskFormer on three widely-used benchmark datasets for shadow removal:

  • ISTD: Contains 1,870 image triplets (shadow image, shadow-free image, shadow mask).
  • ISTD+: An adjusted version of ISTD that aims to reduce illumination inconsistency between shadow and shadow-free images.
  • SRD: Contains 2,680 training and 408 testing pairs of shadow and shadow-free images. For this dataset, predicted masks from another method were used.

Key Insights and Ideas

  • Early Shadow Information Integration is Key: The most significant insight is that incorporating shadow mask information at the very beginning of the pipeline (patch embedding) is highly effective. This "early bird" approach allows the model to focus on shadow regions from the outset, leading to better performance and efficiency.
  • MAPE's Simplicity and Effectiveness: The proposed MAPE module is surprisingly simple yet powerful. It avoids complex architectural changes and relies on clever manipulation of shadow masks to guide the learning process.
  • Dual Binarization for Robustness: The use of both 0/1 and -1/+1 binarization schemes for the shadow mask is crucial. It not only helps in re-balancing pixel intensities but also contributes to the model's robustness, even when faced with inaccurate or low-quality shadow masks.
  • Transformer Efficiency: By shifting the shadow-specific processing to the patch embedding stage, ShadowMaskFormer significantly reduces the computational burden on the transformer blocks, leading to a more efficient model.

Key Results

  • State-of-the-Art Performance: ShadowMaskFormer achieves state-of-the-art results on the ISTD, ISTD+, and SRD datasets, outperforming existing methods in terms of Mean Absolute Error (MAE).
  • Parameter Efficiency: The model is remarkably parameter-efficient, boasting only 2.2MB of network parameters, which is significantly less than many competing methods (e.g., half of CRFormer).
  • Robustness to Mask Quality: Experiments show that ShadowMaskFormer maintains strong performance even with inaccurate or low-quality shadow masks, demonstrating its practical applicability. For instance, even with a sevenfold increase in the Balance Error Rate (BER), the MAE only increased by 11%.
  • Generalization: The model shows good generalization capabilities, performing well on unseen scenarios like shadows cast on walls.

Limitations and Future Work

  • Model Size vs. Performance Trade-off: While the paper demonstrates that increasing model parameters can improve performance, they opt for a middle-ground configuration to balance efficiency and effectiveness. This suggests that further exploration of optimal model sizes could be beneficial.
  • Physical Parameters: The authors express interest in further exploring shadow removal methods based on the physical parameters of the shadow model to enhance interpretability and adaptability to different scenes.
  • Further Exploration of MAPE: While MAPE is shown to be effective, there's always room for further research into optimizing its components or exploring alternative mask augmentation strategies.

Summary updated

BibTeX
@article{li2024shadowmaskformer,
  author = {Zhuohao Li},
  title = {{ShadowMaskFormer: Mask Augmented Patch Embedding for Shadow Removal}},
  journal = {IEEE Trans. Artif. Intell.},
  year = {2024},
  url = {https://openreview.net/forum?id=F0J723NDiN},
}
Figure