Skip to content

This project detects anomalies in 2D data using PyTorch for model training and Flutter for a cross-platform application. Key features include πŸ“Š pre-trained models, a πŸ“± Flutter mobile app that shows heat maps, a 🌐 Flask server backend, and a πŸ–₯️ Tkinter desktop app.

License

Notifications You must be signed in to change notification settings

Loai-Houmane/2D-Anomaly-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

2D Anomaly Detection

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.

πŸ“Š Training the Model

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.

✨ Features

  • 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.

βš™οΈ Installation

To set up the project, follow these steps:

  1. Clone the repository to your local machine.

  2. 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
  3. Install the required Python dependencies by running:

    pip install -r requirements.txt 
  4. Download the backbone and add the backbone location to ADD/models/hrnet/hrnet.py at line 12.

  5. Download the pre-trained model and place it in the models folder.

  6. Navigate to the anomaly_detection_app_flutter directory and run the following command to install Flutter dependencies for the mobile application:

    flutter pub get

πŸš€ Usage

πŸ“± For Mobile Application

  1. To start the server, navigate to the ADD directory and run:
    $env:KMP_DUPLICATE_LIB_OK="TRUE"
    python -m models.server
  2. To run the Flutter application, navigate to the anomaly_detection_app_flutter directory and execute:
    flutter run

πŸ–₯️ For Desktop Application

  1. To run the desktop application, navigate to the ADD directory and execute:
    $env:KMP_DUPLICATE_LIB_OK="TRUE"
    python -m models.test

πŸ“· Screenshots

Mobile Application

Mobile App Screenshot 1 Mobile App Screenshot2 Mobile App Screenshot3

Desktop Application

Mobile App Screenshot 1

Server

Mobile App Screenshot 1

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ’˜ Acknowledgements

  • Thanks to the Flutter and PyTorch communities for their invaluable resources.
  • Special thanks to the CDO Project team for their pioneering work.

About

This project detects anomalies in 2D data using PyTorch for model training and Flutter for a cross-platform application. Key features include πŸ“Š pre-trained models, a πŸ“± Flutter mobile app that shows heat maps, a 🌐 Flask server backend, and a πŸ–₯️ Tkinter desktop app.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published