Generic Timeseries Anomaly Detection is a hello world example for understanding usage of autoencoder-based AI models for anomaly detection on TI MCU. This project demonstrates implementation of an AI-based anomaly detection system on AM26x microcontrollers using a simple synthetic waveform dataset.
Unlike classification models, the autoencoder is trained only on normal data and learns to reconstruct normal patterns. At inference, the reconstruction error between the input and output is compared against a threshold - a high error indicates an anomaly.
| Parameter | Value |
|---|---|
| CPU + OS | r5fss0-0 nortos |
| Toolchain | ti-arm-clang |
| Board | am263px-lp |
| Example folder | examples/ai/generic_timeseries_anomalydetection/ |
TI has created a synthetic waveform dataset based on a combined sinusoidal pattern. The normal signal follows y = 1.2 sin(2*pi*f*t) + 0.8 cos(2*pi*f*t) with a base frequency of 1.0 Hz.
| Parameter | Value |
|---|---|
| Sensor | Signal readings |
| Sampling Rate | 100 Hz |
| Channels | 1 (signal magnitude) |
| Samples per File | 5,000 samples |
| Total Files | 92 files (60 Normal, 32 Anomaly) |
The dataset is divided into two classes:
Important: For anomaly detection, the model is trained only on normal data. Anomaly samples are used exclusively for testing.
This autoencoder model AD_17k contains approximately 17,000 parameters. The encoder compresses the input signal into a compact representation, and the decoder reconstructs the signal. During training, the model learns to reconstruct normal patterns with low error. When presented with an anomalous signal, the reconstruction error is significantly higher.
The model takes 4D input (N,C,H,W):
Unlike classification models that output class probabilities, this model produces a reconstructed signal of the same shape as the input (1, 1, 100, 1). The reconstruction error (Mean Squared Error between input and output) is then compared against a threshold:
The threshold value is stored in user_input_config.h as RECONSTRUCTION_ERROR_THRESHOLD.
For this anomaly detection task, the raw signal with downsampling and simple windowing approach produces the best results. The autoencoder learns to reconstruct the temporal shape of the raw waveform, so preserving the original signal structure is critical.
Key configuration parameters in user_input_config.h: