This project implements a real-time anomaly detection system using a deep learning autoencoder model. The system is designed to detect anomalies in time-series signals, specifically simulating vibration sensor data from a mechanical system.
- Synthetic signal generation
- LSTM-based autoencoder for anomaly detection
- Real-time visualization of signals
- Interactive anomaly injection and detection
training.py
: Data generation, model training, and savingtest_random.py
: Real-time anomaly detection and visualization script
- Python 3.8+
- Libraries:
- numpy
- pandas
- tensorflow
- scikit-learn
- plotly
- dash
- keras
- Clone the repository:
git clone https://github.com/yourusername/signal-anomaly-detector.git
cd signal-anomaly-detector
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install required packages:
pip install numpy pandas tensorflow scikit-learn plotly dash keras
- Run the training script to generate synthetic data and train the model:
python training.py
This will generate and save anomaly_detector_model.h5
- Start the real-time anomaly detection:
python test_random.py
- During runtime:
- The script will open a live dashboard in your default web browser
- Press 'a' + Enter to manually inject a random anomaly
- Anomalies will be highlighted in red on the graph
- Model Type: LSTM Autoencoder
- Input: Time-series signals with a 10-step lookback
- Training Data: Synthetic sinusoidal signals with noise
- Anomaly Detection: Based on reconstruction error threshold
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Initialize Git repository (if not already done):
git init
- Add files:
git add training.py test_random.py README.md
- Commit changes:
git commit -m "Initial commit: Real-time Anomaly Detection project"
-
Create a new repository on GitHub
-
Link local repository to GitHub:
git remote add origin https://github.com/yourusername/signal-anomaly-detector.git
- Push to GitHub:
git branch -M main
git push -u origin main
Distributed under the MIT License. See LICENSE
for more information.
stanleyoz
Project Link: https://github.com/stanleyoz/signal_anomaly-detector