The officieal implementation of the paper: CoWS: Self-Supervised Representation Pre-Training for Cross-Machine Fault Diagnosis, which has been published by IEEE Transactions on Emerging Topics in Computational Intelligence.
CoWS (Consistent Wave and Spectrogram) is a novel self-supervised learning method for mechanical fault diagnosis that leverages the consistency between time domain waveforms and time-frequency domain spectrograms. By learning consistent representations across these two complementary views, CoWS achieves superior performance in bearing fault diagnosis tasks.
- 🔄 Cross-domain Consistency: Aligns representations between time-domain and frequency-domain views
- 🎯 Self-supervised Learning: No labeled data required for pre-training
- 📊 Multi-view Learning: Exploits complementary information from wave and spectrogram representations
- ⚡ Efficient Training: Limited data required for fine-tuning
- 🚝 Cross-machine Tasks: Good performance on cross-machine fault diagnosis tasks
CoWS employs a dual-encoder architecture:
- Wave Encoder: 1D ResNet50 for processing time-domain signals
- Spectrogram Encoder: 2D ResNet50 for processing frequency-domain representations
- Contrastive Learning: Maximizes agreement between wave-spectrogram pairs
CoWS is a general contrastive learning model. The wave and sepctrogram encoders can be replaced with your self-defined architectures.
- Python 3.7+
- PyTorch 1.8+
- Clone the repository:
git clone https://github.com/Xiaohan-Chen/CoWS
cd cows- Install dependencies:
pip install -r requirements.txtPlace your bearing data in the Data/ directory following this structure:
Data/
├── Bearing/
│ ├── load0.pkl
│ └── ...
└── HITBearing/
│ ├── load0.pkl
│ └── ...
└── HUSTBearing/
│ ├── load0.pkl
│ └── ...
└── XJTUBearing/
│ ├── load0.pkl
│ └── ...
- Pre-training with CoWS:
python CoWS.py- Linear Evaluation:
python Evaluation.py --label_ratio 0.01- Transfer Learning:
python Transfer.py --tgt_data 'HUSTBearing'--tgt_load 0 --num_train 10If you find CoWS useful in your research, please consider citing:
@ARTICLE{11364255,
author={Chen, Xiaohan and Yang, Rui and Xue, Yihao and Wang, Zidong},
journal={IEEE Transactions on Emerging Topics in Computational Intelligence},
title={CoWS: Self-Supervised Representation Pre-Training for Cross-Machine Fault Diagnosis},
year={2026},
volume={},
number={},
pages={1-13},
keywords={Fault diagnosis;Data models;Cows;Feature extraction;Spectrogram;Machinery;Deep learning;Training;Knowledge transfer;Brain modeling;Self-supervised learning;pre-training model;knowledge transfer;fault diagnosis},
doi={10.1109/TETCI.2026.3654383}}This project is licensed under the MIT License - see the LICENSE file for details.
- TFPred: Learning Discriminative Representations from Unlabeled Data for Few-Label Rotating Machinery Fault Diagnosis. [Paper][GitHub]
- Transfer Learning Fault Diagnosis: A Survey. [Paper][GitHub]
- Few-Shot Fault Diagnosis. [GitHub]
- Thanks to the self-supervised learning open source community
- Special thanks to the mechanical fault diagnosis public datasets
⭐ Star this repository if you find it helpful!


