Locating anomalies in time-series data or video is a classic "Goldilocks" problem. Unsupervised methods are often too noisy, while fully supervised methods are prohibitively expensive due to the need for millisecond-accurate labels. In "Weakly Supervised Temporal Anomaly Segmentation with Dynamic Time Warping," Lee et al. introduce WETAS, a framework that utilizes "weak" instance-level labels—simply knowing if an anomaly occurred at some point—to precisely segment where that anomaly starts and ends.
The Problem: Bridging the Gap Between Points and Instances
Traditional anomaly detection typically falls into two categories: point-level detection (identifying specific anomalous timestamps) and instance-level classification (determining if an entire sequence is anomalous).
The gap lies in temporal segmentation: identifying the specific start and end points of an event. Point-level methods often produce "jittery" results—disconnected points that are difficult for humans to interpret as a single event. Conversely, instance-level labels are easy to acquire but lack localization. WETAS addresses the challenge of training a model to find precise boundaries using only coarse, "yes/no" labels for the entire sequence.
Methodology: The WETAS Framework
WETAS employs a two-stage approach integrated into a single training loop:
- Feature Extraction: A Dilated Causal Convolutional Neural Network (DiCNN) captures long-term dependencies, providing context for each time point based on its history.
- Sequential Pseudo-Labeling: Inspired by Class Activation Maps (CAM), the model identifies segments that contribute most to an "anomaly" classification, creating a rough "pseudo-label" sequence.
- Dynamic Time Warping (DTW) Alignment: This is the core innovation. Because pseudo-labels may not perfectly match the input timing, the authors use soft-DTW. This differentiable version of the DTW algorithm allows the model to "stretch" or "shrink" the alignment between input data and pseudo-labels during training.
- Dual Loss Function: The model optimizes for both Classification Loss ($L_c$) (correctly identifying anomalous instances) and Alignment Loss ($L_a$) (ensuring predicted scores align with pseudo-labels).
Experimental Results
The researchers evaluated WETAS on four diverse real-world datasets: EMG (muscle activity), GHL (gasoil plant), SMD (server monitoring), and Subway (surveillance video).
WETAS significantly outperformed unsupervised and weakly supervised baselines like DeepMIL:
- Performance: On the SMD dataset, WETAS achieved an F1-score of 0.4358, surpassing the best DeepMIL variant (0.3568).
- Interpretability: Qualitative results demonstrate that while point-level detectors produce spiky, disconnected predictions, WETAS generates clean, continuous blocks that closely match ground-truth boundaries.
- Video Domain: On the Subway dataset, WETAS achieved a 97.8% AUROC, outperforming domain-specific unsupervised detectors.
Conclusion
By shifting the focus from independent points to continuous segments and leveraging the flexibility of Dynamic Time Warping, WETAS provides a robust solution for real-world anomaly localization. It effectively handles variable-length anomalies without requiring expensive point-by-point ground truth, making it a practical tool for industrial and surveillance applications.
Summary updated