This is the code of "TreeMIL: A Multi-instance Learning Framework for Time Series Anomaly Detection with Inexact Supervision" (IEEE ICASSP 2024)
Figure 1. The overall framework of TreeMIL.
Our proposed framework, termed as TreeMIL, optimizes model by leveraging only weak supervision (i.e., instance-level anomaly labels, rather than point-level anomaly labels). The framework is designed with three charaterisctis:
- The entire time series is represented as a N -ary tree, where nodes represent subsequences of varying lengths
- The anomalous features of each node (subsequence) are generated using an attention mechanism that incorporates information from its parent node, children nodes, neighbor nodes and itsel
- The anomaly discriminator considers anomaly features from subsequences at various scales when calculating point-level anomaly scores.
- numpy
- numba
- scikit-learn
- pytorch
-
You can download the raw datasets from the following links.
- EMG : http://archive.ics.uci.edu/ml/datasets/EMG+data+for+gestures
- GECCO : https://bit.ly/3fOeRvI
- SWAN-SF : https://bitbucket.org/gsudmlab/mvtsdata_toolkit/downloads/petdataset_01.zip%20
- Credit Card : https://www.openml.org/d/1597
- SMD : https://github.com/smallcowbaby/OmniAnomaly
- PSM : https://github.com/eBay/RANSynCoders
- SMAP : https://github.com/khundman/telemanom
-
You need to split the whole temporal data into a training set, a validation set, and a test set.
-
Then, place the files in the corresponding directories.
./data/{DATASET}/train
,./data/{DATASET}/valid
, and./data/{DATASET}/test
-
We provide the preprocessed EMG dataset as an example.
- You can simply run the code with the default setting, by using the following command.
python train.py
Figure 2. Weak F1-score, dense F1-score, and IoU
Figure 3. Precision, recall, and AUC-ROC
Figure 4. Both long and short collective anomalies can be captured by multi-scale nodes in the tree
- 2021_ICCV_Weakly Supervised Temporal Anomaly Segmentation with Dynamic Time Warping
- https://github.com/tsy935/eeg-gnn-ssl
- https://github.com/thuml/Anomaly-Transformer