VETime
Vision-Enhanced Zero-Shot Time Series Anomaly Detection
This repository provides only the official pretrained weights for VETime. The complete code is available in the VETime code repository.
VETime is a vision-enhanced framework for zero-shot time-series anomaly detection. It combines temporal and visual representations to detect both short point anomalies and long-range contextual anomalies while retaining timestamp-level localization.
- Paper: arXiv:2602.16681
- Code: yyyang0/VETime
- Checkpoints: yyyang0/VETime-checkpoints
Model overview
VETime contains four main components:
- Traceable Image Conversion (TIC) transforms a time series into a dense visual representation while preserving temporal correspondence.
- Patch-Level Temporal Alignment (PTA) maps visual patches back to the temporal axis.
- Anomaly Window Contrastive Learning (AWCL) improves discrimination of short and long anomaly patterns.
- Task-Adaptive Multi-Modal Fusion (TMF) dynamically combines temporal, visual, and anomaly-enhanced features.
The model outputs an anomaly score for each timestamp and is evaluated without target-domain training or fine-tuning.
Repository contents
| File | Approx. size | Purpose |
|---|---|---|
VETime.pth |
664.4 MB | Main VETime checkpoint used for evaluation |
weight_v/mae_visualize_base.pth |
447.7 MB | MAE-Base visual encoder checkpoint |
weight_ts/full_mask_anomaly_head_pretrain_checkpoint_best.pth |
444.8 MB | Pretrained time-series encoder/anomaly-head checkpoint, mainly used for initialization and training |
VETime.pthandweight_v/mae_visualize_base.pthare required by the current evaluation path. The publishedTest_TSB.pyaccepts--ts_path, but the current implementation does not load that argument during evaluation.
Installation
The reference implementation was tested with Python 3.11, PyTorch 2.3.0, and CUDA 12.1.
git clone https://huggingface.co/yyyang0/VETime
cd VETime
conda create -n VETime python=3.11 -y
conda activate VETime
conda install pytorch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 pytorch-cuda=12.1 -c pytorch -c nvidia
pip install -r requirements.txt
pip install -U huggingface_hub
Download checkpoints
Download the complete repository directly into the path expected by the code:
hf download yyyang0/VETime-checkpoints --local-dir ./checkpoints
Legacy CLI installations may use:
huggingface-cli download yyyang0/VETime-checkpoints --local-dir ./checkpoints
The resulting layout should be:
VETime/
βββ checkpoints/
βββ VETime.pth
βββ weight_ts/
β βββ full_mask_anomaly_head_pretrain_checkpoint_best.pth
βββ weight_v/
βββ mae_visualize_base.pth
Data preparation
VETime is evaluated on the TSB-AD benchmark. Download TSB-AD-U and/or TSB-AD-M and place them under your chosen dataset directory.
For TSB-AD CSV files, the current evaluation script expects:
- the final column to be named
Label; - all earlier columns to contain time-series values;
- the filename to follow the TSB-AD naming convention used by the benchmark code.
The path in config/run_vetime_test.sh may differ from your local layout. Set DATASET_DIR to the directory that actually contains the CSV files.
Evaluation
Option 1: use the provided script
Edit these values in config/run_vetime_test.sh before running it:
DATASET_DIR="./dataset/Datasets/TSB-AD-U" # change to your actual path
VISION_NAME="mae_visualize_base.pth"
VETIME_PATH="./checkpoints/VETime.pth"
Then run:
bash config/run_vetime_test.sh
Option 2: call the evaluation entry point directly
python Test_TSB.py \
--model_name VETime \
--dataset_dir ./dataset/Datasets/TSB-AD-U \
--save_dir ./output/metrics/uni/ \
--device cuda:0 \
--vision_name mae_visualize_base.pth \
--vetime_path ./checkpoints/VETime.pth \
--num_workers 10
The script writes per-series anomaly scores and aggregate evaluation CSV files under --save_dir.
Published results
The paper evaluates VETime on 26 public datasets from TSB-AD using Affiliation-F1, F1-T, Standard-F1, and VUS-PR. The macro-averages below are calculated from the per-dataset VUS-PR values in Table 1 of arXiv v3.
| Setting | Number of datasets | Macro-average VUS-PR |
|---|---|---|
| Univariate | 11 | 49.14% |
| Multivariate | 15 | 32.31% |
Please refer to the paper for per-dataset results, baseline comparisons, ablations, and efficiency analysis.
Intended use
VETime is intended for research on zero-shot univariate and multivariate time-series anomaly detection, including evaluation on TSB-AD-compatible data.
The current release is a PyTorch research checkpoint and is not yet packaged as a standalone Transformers model. Load it through the official VETime codebase rather than transformers.AutoModel.from_pretrained().
Limitations
- Seasonal-trend decomposition can be sensitive to irregular high-frequency noise.
- The channel-independent multivariate design may not fully capture cross-variable dependencies.
- Very high-dimensional inputs may lose fine-grained information when mapped to a fixed visual canvas.
- The vision backbone adds compute and memory overhead.
- The current public code focuses on benchmark evaluation and does not yet expose a minimal arbitrary-series inference API comparable to
TimeRCDDetector.
Users should independently validate thresholds, calibration, and failure modes before applying the model to safety-critical or production systems.
License
The official code is released under the Apache License 2.0. Check the licenses and usage terms of TSB-AD and any other datasets separately.
Citation
@article{yang2026vetime,
title = {VETime: Vision Enhanced Zero-Shot Time Series Anomaly Detection},
author = {Yingyuan Yang and Tian Lan and Yifei Gao and Yimeng Lu and Xuming An and Wenjun He and Meng Wang and Chenghao Liu and Chen Zhang},
journal = {arXiv preprint arXiv:2602.16681},
year = {2026}
}