This project focuses on detecting anomalies in 2D data using advanced machine learning models. It leverages the power of PyTorch for model training and Flutter for creating a cross-platform application that allows users to interact with the anomaly detection system.
I used the MVTec AD dataset, which is specifically designed for benchmarking anomaly detection methods. The dataset contains over 5,000 high-resolution images divided into 15 different object and texture categories. Each category has normal images and images with various defects, making it ideal for training and evaluating anomaly detection algorithms.
-
Pre-trained Models: Access pre-trained models like
models/carpet.pt
for quick deployment. -
π± Cross-Platform Application: A Flutter-based application (
anomaly_detection_app_flutter
) for easy interaction with the model. -
π Server Backend: A Flask server (
models/server.py
) that serves the model predictions. -
π₯οΈ Desktop Application: A Tkinter-based desktop application for local anomaly detection.
To set up the project, follow these steps:
-
Clone the repository to your local machine.
-
Ensure you create a virtual environment first with python version 3.7.1 .
# Create a new conda environment with Python 3.7.1 conda create --name myenv python=3.7.1 # Activate the conda environment conda activate myenv
-
Install the required Python dependencies by running:
pip install -r requirements.txt
-
Download the backbone and add the backbone location to
ADD/models/hrnet/hrnet.py
at line 12. -
Download the pre-trained model and place it in the
models
folder. -
Navigate to the
anomaly_detection_app_flutter
directory and run the following command to install Flutter dependencies for the mobile application:flutter pub get
- To start the server, navigate to the
ADD
directory and run:$env:KMP_DUPLICATE_LIB_OK="TRUE" python -m models.server
- To run the Flutter application, navigate to the
anomaly_detection_app_flutter
directory and execute:flutter run
- To run the desktop application, navigate to the
ADD
directory and execute:$env:KMP_DUPLICATE_LIB_OK="TRUE" python -m models.test
This project is licensed under the MIT License - see the LICENSE
file for details.
- Thanks to the Flutter and PyTorch communities for their invaluable resources.
- Special thanks to the CDO Project team for their pioneering work.