Skip to content

shaeelhashmi/Bearing-Prediction

Repository files navigation

Bearing-Prediction

A machine learning project for predicting bearing health and damage conditions using vibration signals and operational parameters.

Overview

This project combines machine learning with a full-stack web application to predict bearing conditions and diagnose potential failures. The system analyzes operational data including speed, torque, and force measurements, along with vibration signal files to classify bearing health status.

Features

  • Bearing Health Classification: Predicts three severity levels:

    • Healthy - No fault detected, bearing operating normally
    • Light Damage - Early-stage damage or artificially-induced faults (EDM, drilling, engraving)
    • Heavy Damage - Advanced deterioration or fatigue damage requiring immediate attention
  • Fault Location Detection: Identifies where damage occurs:

    • Inner Ring (IR)
    • Outer Ring (OR)
    • Outer Ring + Inner Ring (OR+IR)
    • No fault location
  • Damage Type Classification: Categorizes damage as:

    • Drilling
    • EDM (Electrical Discharge Machining)
    • Engraving
    • Fatigue
    • Plastic Deformation
    • None
  • Interactive Web Interface: Modern React-based frontend for easy prediction and visualization

Project Structure

bearing-project/
├── Backend/
│   └── main.py           # Flask API for model predictions
├── frontend/             # React + Vite web application
│   ├── src/
│   │   ├── App.jsx       # Main application component
│   │   ├── App.css       # Styling
│   │   ├── index.css     # Tailwind CSS imports
│   │   └── main.jsx      # React entry point
│   ├── public/           # Static assets
│   ├── vite.config.js    # Vite configuration
│   └── package.json      # Frontend dependencies
└── README.md

Tech Stack

Backend

  • Python with Flask REST API
  • Machine Learning: Scikit-learn with LabelEncoder for multi-class classification
  • Data Format: .mat files (MATLAB format) for vibration signal input

Frontend

  • React 19 - UI framework
  • Vite - Build tool and dev server
  • Tailwind CSS - Utility-first CSS framework
  • React Hooks - State management
  • Modern CSS - Custom styling with CSS variables

Getting Started

Prerequisites

  • Python 3.8+
  • Node.js 16+ and npm
  • Git

Backend Setup

  1. Navigate to the Backend directory:

    cd bearing-project/Backend
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Run the Flask server:

    python main.py

The API will be available at http://localhost:5000 by default.

Frontend Setup

  1. Navigate to the frontend directory:

    cd bearing-project/frontend
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev

The application will be available at http://localhost:5173 (or another port if 5173 is in use).

  1. For production build:
    npm run build

API Endpoints

GET /config

Returns the configuration including severity levels, location classes, and damage types to keep frontend and backend in sync.

Response:

{
  "severity_meta": { ... },
  "location_classes": ["IR", "None", "OR", "OR+IR"],
  "damage_classes": ["Drilling", "EDM", "Engraving", "Fatigue", "None", "Plastic Def."]
}

POST /predict

Predicts bearing condition from a .mat file and operational parameters.

Request:

  • file: .mat vibration signal file (multipart/form-data)
  • speed_rpm: Motor/bearing speed in RPM (number)
  • torque_Nm: Torque in Newton-meters (number)
  • force_N: Force in Newtons (number)

Response:

{
  "severity": {
    "code": 0,
    "label": "Healthy",
    "description": "No fault detected. Bearing operating normally.",
    "color": "#00ff9d",
    "recommendation": "Continue standard monitoring schedule."
  },
  "location": "None",
  "damage_type": "None",
  "confidence": 0.95
}

Usage

  1. Start both backend and frontend servers (in separate terminals)
  2. Open the web interface at http://localhost:5173
  3. Select operational parameters:
    • Speed (RPM)
    • Torque (Nm)
    • Force (N)
  4. Upload a .mat vibration signal file by dragging or clicking
  5. Click "Predict" to get the bearing health assessment
  6. Review results including severity, damage location, and recommendations

Model Details

The machine learning model uses:

  • LabelEncoder for categorical features (location, damage type)
  • Severity classification with three levels (Healthy, Light Damage, Heavy Damage)
  • Multi-output prediction for comprehensive bearing diagnostics

The model maps predictions to human-readable labels and provides actionable recommendations based on detected conditions.

Development

Linting

Run ESLint on the frontend:

npm run lint

Project Status

  • ✅ Full-stack application
  • ✅ Backend ML API
  • ✅ Interactive React frontend
  • ✅ Vibration signal processing
  • ✅ Multi-class bearing diagnostics

License

This project is provided as-is for educational and research purposes.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests to improve the project.

Contact

For questions or suggestions, please open an issue in the repository.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages