|
| 1 | +# Overview of the GEDAD Algorithm |
| 2 | + |
| 3 | +Here we provide a detailed explanation of the **G**yroscope **E**uclidean **D**istance **A**nomaly **D**etection (GEDAD) algorithm, which initially developed for gyroscopes, and now it has been extended to 3-axis accelerometers while retaining its original name. The GEDAD algorithm consists of two core phases: **learning** and **inference**. |
| 4 | + |
| 5 | +### Data Acquisition and Pre-processing |
| 6 | + |
| 7 | +The process begins with data acquisition. While vibration data is collected from a 3-axis accelerometer via I2C and stored in a circular buffer, later the data undergoes a linear transformation where it is multiplied by a coefficient `alpha`, and added with another coefficient `beta`. |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +### Learning Phase |
| 12 | + |
| 13 | +The objective of the learning phase is to establish a **baseline template of normal vibration** for the measuring device. |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +1. **Template Generation**: First, a `sliding window` of 3-axis acceleration data, sized to cover a complete normal operational cycle, is collected to serve as the **template data**. |
| 18 | +2. **Distance Calculation**: The algorithm then randomly samples `N` short data segments or named `chunks` from identical positions within each channel of the template. Each chunk is then slid across the entire template of its corresponding channel with a defined `sliding step`, calculating the Euclidean (L2) distance at each position. |
| 19 | +3. **Threshold Calculation**: Next, outliers are filtered from these distances (e.g., using the 3σ rule; specifically, values less than a given EPS). For each channel, the remaining distances are sorted to identify the `M` smallest values. An average **threshold** is then computed for each channel from these `M` distances, defining the boundary between normal and abnormal states. |
| 20 | +4. **Parameter Calibration**: Finally, an additional parameter, `C`, is determined by finding the median counts of consecutive instances where the Euclidean distance is below the threshold during a subsequent comparison. This parameter is stored to enhance detection accuracy in the next phase. |
| 21 | + |
| 22 | +### Inference Phase |
| 23 | + |
| 24 | +During inference, the algorithm compares real-time 3-axis acceleration data against the established **template data** to identify any vibrations that do not match the normal *fingerprint*. |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +The process is similar to training, but it uses real-time data segments for comparison instead of randomly sampled `chunks`. |
| 29 | + |
| 30 | + * If the real-time data segment is sufficiently similar to a portion of the template (i.e., its Euclidean distance is below the threshold), the vibration is deemed **normal**. |
| 31 | + * Conversely, if the distance remains above the threshold after comparison against the entire template, the system flags the vibration as an **anomaly**. |
| 32 | + |
| 33 | +The actual computation is more complex, involving the fusion of anomaly scores across channels and the use of the parameter `C`. |
| 34 | + |
| 35 | +## Summary and Future Work |
| 36 | + |
| 37 | +In summary, the algorithm's advantages include: |
| 38 | + |
| 39 | + * Fast training speed |
| 40 | + * Low computational overhead |
| 41 | + * Suitability for low-power embedded devices |
| 42 | + * Requires only a small amount of normal data for training |
| 43 | + |
| 44 | +We are also exploring engineering optimizations, such as using Fast Fourier Transform (FFT) to analyze frequency components and considering time-frequency characteristics and average amplitude. Future work will focus on further enhancing the algorithm's accuracy, efficiency and robustness. |
0 commit comments