Skip to content

97yong/signal-generation-WGAN-CGAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

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

Repository files navigation

πŸ”§ Fault Diagnosis using WGAN-CGAN on CWRU Dataset

This project implements a Wasserstein Conditional GAN (WGAN-CGAN) model for generating class-conditional vibration signals using the CWRU (Case Western Reserve University) dataset. It aims to synthesize realistic 1D signals corresponding to different bearing fault types and compare their spectral similarity to the real signals.


πŸ“ Project Structure

GAN_CWRU/
β”œβ”€β”€ main.py                  # Main training/evaluation script
β”œβ”€β”€ arguments.py             # CLI training options
β”œβ”€β”€ model.py                 # WGAN-CGAN Generator & Discriminator
β”œβ”€β”€ train.py                 # WGAN-CGAN training loop
β”œβ”€β”€ test.py                  # FFT-based evaluation & plotting
β”œβ”€β”€ dataset.py               # DataLoader construction
β”œβ”€β”€ preprocess.py            # CWRU .mat preprocessing to (X, Y)

πŸ“¦ Data Structure

raw_data/
β”œβ”€β”€ 97.mat     # Normal
β”œβ”€β”€ 105.mat    # Inner Race fault
β”œβ”€β”€ 118.mat    # Ball fault
β”œβ”€β”€ 130.mat    # Outer Race fault

Each file contains DE-side vibration signals under different operating conditions.

Preprocessing extracts 4000 samples per class using a sliding window of length 1200 points.


πŸš€ How to Run

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

The training script will:

  1. Load and preprocess the CWRU dataset
  2. Train the WGAN-CGAN model to generate fault-specific signals
  3. Evaluate spectral similarity (FFT cosine similarity) between real and generated samples
  4. Visualize results with boxplots and FFT curves

🧠 Model Overview

  • Generator: MLP that takes noise + class label β†’ vibration signal
  • Discriminator: MLP that scores real/fake given signal + class label
  • Loss: Wasserstein loss (with weight clipping)
  • Optimization: RMSProp (as recommended in WGAN)

πŸ“Š Evaluation Method

Generated samples are compared with real signals from each class using FFT-based cosine similarity.
For each class, the average FFT similarity is computed and plotted:

  • πŸ“ˆ fft_similarity_boxplot.png: Boxplot per class
  • 🎨 fft_comparison_samples.png: Real vs Generated FFT curves

⚠️ Observations

  • Class-conditional generation works well for most fault types (IR, Ball, Outer).
  • Normal data is harder to generate realistically due to lack of high-frequency components or variation.

FFT Cosine Similarity Boxplot
Figure 1. Cosine Similarity between real and generated signals (FFT-based)

FFT Comparison of Real vs Generated
Figure 2. Sample FFT curves - Real vs Generated per class

Future improvements (e.g., spectral loss, multi-resolution FFTs, or 1D CNN-based discriminator) could enhance the ability to capture subtle patterns in normal signals.


Views

πŸ“Ž References

About

🧠 [Signal] Fault-specific vibration signal generation using WGAN-CGAN

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages