Skip to content

Latest commit

 

History

History
90 lines (65 loc) · 2.87 KB

Readme.md

File metadata and controls

90 lines (65 loc) · 2.87 KB

🔧 [1D classification] Fault Diagnosis using CNN

This project implements a complete modular pipeline for classifying bearing faults using Convolutional Neural Networks on the CWRU (Case Western Reserve University) dataset.


📁 Project Structure

cnn_pipeline/
├── main.py                  # Main training/evaluation script
├── arguments.py             # Command-line arguments
├── dataset.py               # DataLoader generation
├── model.py                 # CNN model definition
├── train.py                 # Training function (with early stopping)
├── test.py                  # Test function
├── preprocess.py            # CWRU .mat file preprocessing

📥 Dataset

This project uses the publicly available CWRU Bearing Data from Case Western Reserve University. You can download the dataset files from the official website below:

🔗 https://engineering.case.edu/bearingdatacenter/download-data-file

Please place the downloaded .mat files inside the raw_data/ directory:

raw_data/
├── 97.mat     # Normal
├── 105.mat    # Inner race fault
├── 118.mat    # Ball fault
├── 130.mat    # Outer race fault

The preprocess.py module converts raw signals into sliding window segments for supervised classification.


🚀 How to Run

pip install numpy scipy torch scikit-learn matplotlib tqdm
python main.py

The script will:

  1. Preprocess raw .mat files into (X, Y) arrays
  2. Split data into train/valid/test
  3. Train CNN using early stopping
  4. Evaluate final test accuracy

🧠 CNN Architecture

Three-layer 1D convolutional encoder with ReLU, BatchNorm, and MaxPooling followed by fully connected classification layers.

Input → Conv1d → ReLU → MaxPool → Conv1d → ReLU → MaxPool → Conv1d → Flatten → FC layer → FC layer → Output

📈 Training Options (arguments.py)

ArgumentDescriptionDefault
--epochsNumber of training epochs10
--lrLearning rate1e-4
--lamdaLR scheduler decay0.97
--early_stopEarly stopping patience20
--train_sizeTrain/val split ratio0.8
--batch_sizeMini-batch size64