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.
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)
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.
pip install numpy torch scipy matplotlib pandas scikit-learn tqdm
python main.py
The training script will:
- Load and preprocess the CWRU dataset
- Train the WGAN-CGAN model to generate fault-specific signals
- Evaluate spectral similarity (FFT cosine similarity) between real and generated samples
- Visualize results with boxplots and FFT curves
- 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)
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
- 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.
Figure 1. Cosine Similarity between real and generated signals (FFT-based)
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.
- π CWRU Dataset: https://engineering.case.edu/bearingdatacenter/download-data-file
- π WGAN: Arjovsky et al., 2017. "Wasserstein GAN" [arXiv]
- π CGAN: Mirza & Osindero, 2014. "Conditional Generative Adversarial Nets" [arXiv]