Generic Timeseries Classification
Introduction
AI-based real-time waveform classification example, which uses a simple dataset with three classes.
Dataset and Model Details
Dataset
TI has created a specialized waveform dataset containing signal measurements. The dataset is divided into three classes: sine waveform, sawtooth waveform and square waveform.
Parameter |
Value |
|---|---|
Sensor |
Signal readings |
Sampling Rate |
40 Hz |
Channels |
1 (Signal magnitude) |
Samples per File |
25,600 samples |
Total Files |
75 files (~25 files in each of 3 classes) |
Model Architecture
Lightweight classification model CLS_1k_NPU has ~1,000 parameters and follows a streamlined architecture consisting of four convolutional layers (each enhanced with BatchNorm and ReLU activation functions) followed by a single linear layer.
Inference run on TinyEngine NPU
Input Features
The model takes 4D input (N,C,H,W):
N (1): batch size which is restricted to 1
C (1): channels which is 1 for signal
H (256): samples of timeseries signals which is 256 in this example
W (1): width of samples is restricted to 1 for timeseries applications
Output Classes
Class 0: Sine waveform
Class 1: Sawtooth waveform
Class 2: Square waveform
Feature Extraction Configuration
For this waveform detection system, applying FFT to identify frequencies, followed by binning and logarithmic scaling produces superior results.
FE_FFT: Performs Fast Fourier Transform on the raw frame, calculating magnitude values from complex outputs
FE_DC_REM: Removes the DC component from Fourier transform
FE_BIN: Groups frequencies into bins, reducing dimensionality while preserving frequency distribution patterns
FE_LOG: Applies logarithmic scaling to the binned frequency data
FE_CONCAT: Combines scaled outputs from multiple data frames for temporal context
Key parameters
FE_FRAME_SIZE: 1024 samples per FFT frame
FE_FEATURE_SIZE_PER_FRAME: 64 features per frame
FE_NUM_FRAME_CONCAT: 8 frames concatenated
FE_FFT_BIN_SIZE: 8 (bin width)
FE_NN_OUT_SIZE: 3 (number of output classes)