Skip to content

🚨 [Signal] Deep learning-based fault classification of vibration signals using CNN

Notifications You must be signed in to change notification settings

97yong/signal-fault-classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”§ [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

About

🚨 [Signal] Deep learning-based fault classification of vibration signals using CNN

Topics

Resources

Stars

Watchers

Forks

Languages