Fusion of Short-term and Long-term Attention for Video Mirror Detection

Mingchen Xu, Jing Wu, Yu-Kun Lai, Ze Ji · DOI

Abstract

Video mirror detection (VMD) is a complex task because mirrors lack a fixed visual signature, instead reflecting their surroundings. Current methods often fail when reflections change rapidly or when confronted with "mirror mimics" like paintings or windows. We present FusionFormer, a novel transformer-based framework that addresses these challenges by simulating the human dual-scale approach to mirror identification: using short-term cues for initial detection and long-term context for verification. FusionFormer incorporates Dual Gated Short-term Attention (DGSA) and Long-term Attention (LA) modules, fused via a Short-Long Fusion (SLF) module. To support more robust evaluation, we introduce ViMirr, a large-scale, diverse benchmark dataset. Our experiments demonstrate that FusionFormer significantly outperforms existing state-of-the-art models in both accuracy and robustness.

Introduction

Detecting mirrors in video sequences is a fundamental yet difficult problem in computer vision. Unlike standard objects, mirrors are defined by their reflections, which vary based on the viewpoint and the environment. While static image mirror detection has seen progress, video mirror detection (VMD) must maintain temporal consistency. Existing VMD approaches typically rely on finding correspondences between reflections and real objects. However, these methods are prone to failure during rapid reflection changes or when encountering objects with similar local visual properties, such as framed artwork.

We observe that humans identify mirrors by first spotting a candidate based on immediate appearance and then verifying it using a broader temporal context. FusionFormer is designed to mimic this intuition, separating the detection and verification processes into specialized attention mechanisms.

Methods

FusionFormer is built upon the Mix Transformer (SegFormer) backbone and introduces three key components to handle temporal and contextual information:

  1. Dual Gated Short-term Attention (DGSA): This module processes adjacent frames to extract short-term appearance features. It employs spatial and channel-wise gates to filter out noise caused by sudden occlusions or lighting fluctuations, ensuring the model only relies on reliable temporal correspondences.
  2. Long-term Attention (LA): To provide a "global view," the LA module compares the current frame with a randomly selected distant frame from the video. This helps the model distinguish mirrors from static mimics by understanding the broader environmental context.
  3. Short-Long Fusion (SLF): This module selectively integrates the short-term appearance data with long-term contextual information to generate the final mirror mask.
Overview of the FusionFormer architecture, highlighting the DGSA, LA, and SLF modules.

The model is optimized using a combination of Binary Cross-Entropy (BCE) and Lovasz-hinge loss, focusing on achieving precise segmentation boundaries.

Datasets

A significant contribution of this work is the introduction of the ViMirr dataset. Existing benchmarks, such as the standard VMD dataset, are heavily biased toward specific environments like furniture stores, which limits model generalization. ViMirr contains 19,255 frames across 281 videos, covering 20 diverse scene types including gyms, elevators, and kitchens. It features a significantly lower similarity score (39.54%) compared to the VMD dataset (51.21%), representing a more rigorous test of real-world performance.

Results

FusionFormer achieves state-of-the-art (SOTA) results across all evaluated metrics. On the challenging ViMirr dataset, FusionFormer reached an IoU of 0.6455, nearly doubling the performance of the previous leading video-specific model, VMDNet (0.4224). On the standard VMD dataset, it achieved an IoU of 0.6343 and an F-measure ($F_\beta$) of 0.8104.

Qualitative comparison showing FusionFormer's superior ability to distinguish mirrors from mimics compared to other state-of-the-art methods.

Qualitative analysis reveals that FusionFormer is particularly effective at ignoring "mirror mimics" like wall-mounted posters, which frequently confuse competing models. The gating mechanism in the DGSA module allows it to maintain robustness even in the presence of visual noise.

Conclusion

FusionFormer represents a significant advancement in video mirror detection by effectively combining short-term and long-term visual attention. The introduction of the ViMirr dataset provides a more realistic benchmark for the field. Future research will focus on optimizing the architecture for real-time applications in robotics and extending the model's capability to handle very long-duration video sequences.

Summary updated

BibTeX
@inproceedings{xu2024fusion,
  author = {Mingchen Xu and Jing Wu and Yu-Kun Lai and Ze Ji},
  title = {{Fusion of Short-term and Long-term Attention for Video Mirror Detection}},
  booktitle = {ICME},
  year = {2024},
  url = {https://openreview.net/forum?id=oBZ0c8DgBg},
}
Figure