This repository contains a 1D convolutional autoencoder for anomaly detection on unprocessed time-series data. The model is trained on nominal data only and uses reconstruction error to identify anomalies, avoiding the need for manual feature engineering.
It can be integrated into an Edge Impulse pipeline to:
- Replace traditional methods like k-means or GMM
- Train directly on raw time-series data
- Deploy to edge devices using the standard Edge Impulse workflow
This model is designed to run as a custom learning block in Edge Impulse, paired with the raw data processing block. See the Custom blocks and Custom learning blocks documentation for additional details.
Following the steps below makes the block available under any of your projects, just like any other learning block, so you can add it to your impulse and deploy the model to an edge device.
- Install the Edge Impulse CLI
- Clone this repo
- Change into the block directory
- Initialize the block:
$ edge-impulse-blocks init --clean
- Push the block to Edge Impulse:
$ edge-impulse-blocks push
You can run this pipeline locally with Docker. This encapsulates all dependencies and packages for you.
Following the steps below will train the model and create a saved model ZIP file in the out directory.
- Install Docker Desktop
- Install the Edge Impulse CLI
- Create a new Edge Impulse project and add data
- Under Create impulse add a Raw data processing block and any anomaly detection learning block
- Clone this repo
- Change into the block directory
- Initialize the block:
$ edge-impulse-blocks init --clean
- Fetch new data:
$ edge-impulse-blocks runner --download-data data/
- Build the container:
$ docker build -t custom-ml-autoencoder-ad .
- Run the container:
macOS / Linux
$ docker run --rm -v $PWD:/app custom-ml-autoencoder-ad --data-directory /app/data --epochs 50 --learning-rate 0.001 --out-directory out/
Windows (Command prompt)
$ docker run --rm -v "%cd%":/app custom-ml-autoencoder-ad --data-directory /app/data --epochs 50 --learning-rate 0.001 --out-directory out/
Windows (Powershell)
$ docker run --rm -v ${PWD}$:/app custom-ml-autoencoder-ad --data-directory /app/data --epochs 50 --learning-rate 0.001 --out-directory out/