This repository is an open-source library for cross-domain fault diagnosis, including Single-source Unsupervised Domain Adaptation (SUDA) and Multi-source Unsupervised Domain Adaptation (MUDA) methods.
- ACDANN - Integrating expert knowledge with domain adaptation for unsupervised fault diagnosis. [TIM 2021] [Code]
- ADACL - Adversarial domain adaptation with classifier alignment for cross-domain intelligent fault diagnosis of multiple source domains. [MST 2020] [Code]
- BSP - Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. [ICML 2019] [Code]
- CDAN - Conditional adversarial domain adaptation. [NIPS 2018] [Code]
- CORAL - Deep coral: Correlation alignment for deep domain adaptation. [ECCV 2016] [Code]
- DAN - Learning transferable features with deep adaptation networks. [ICML 2015] [Code]
- DANN - Unsupervised domain adaptation by backpropagation. [ICML 2015] [Code]
- IRM - Invariant risk minimization. [ArXiv] [Code]
- MCD - Maximum classifier discrepancy for unsupervised domain adaptation. [CVPR 2018] [Code]
- MDD - Bridging theory and algorithm for domain adaptation. [ICML 2019] [Code]
- MFSAN - Aligning domain-specific distribution and classifier for cross-domain classification from multiple sources. [AAAI 2019] [Code]
- MSSA - A multi-source information transfer learning method with subdomain adaptation for cross-domain fault diagnosis. [Knowledge-Based Systems 2022] [Code]
- MixStyle - Domain generalization with mixstyle. [ICLR 2021] [Code]
- python3 (>=3.8)
- Pytorch (>=1.10)
- numpy (>=1.21.2)
- pandas (>=1.5.3)
- tqdm (>=4.46.1)
- scipy (>=1.10)
Download the data from a public bearing or gearbox fault dataset. Loading code for the following datasets is provided referring to this.
- CWRU - Case Western Reserve University dataset.
- MFPT - Machinery Failure Prevention Technology dataset.
- PU - Paderborn University dataset.
- XJTU - Xi’an Jiaotong University dataset.
- IMS - Intelligent Maintenance Systems dataset.
According to different operation conditions, divide a specific dataset into folders like "op_0", "op_1" and so on. In each "op_?" folder, use subfolders for different categories, which contain the fault data.
For example, CWRU dataset can be divided into 4 folders according to 4 motor speed. In each folder, data of this operation condition can be classified into 9 fault classes, such as 7 mil Inner Race fault, 14 mil Inner Race fault, 7 mil Outer Race fault and so on (referring to this article). Then, the dataset folder is organized as
.
└── dataset
└── CWRU
├── op_0
│ ├── ball_07
│ │ └── 122.mat
│ ├── inner_07
│ │ └── 109.mat
│ ...
├── op_1
│ ├── ball_07
│ │ └── 123.mat
│ ...
├── op_2
...
You can also try to implement transfer among different datasets. In this case, the categories of faults contained in each dataset must be the same.
For example, organize CWRU and MFPT datasets as follows for one-to-one transfer.
.
└── dataset
├── CWRU
│ ├── inner
| | ├── ***.mat
| | | ***.mat
| | ...
│ ├── normal
│ └── outer
└── MFPT
├── inner
├── normal
└── outer
Note: It is highly recommended to modify the dataset loading code based on custom training. Make sure that datasetname
in the loading code is consistent with names of your subfolders. The sampling length can also be changed by adjusting the signal_size
inside.
Load trained weights.
python train.py --model_name CNN --load_path ./CNN/single_source/model.pth --target_name CWRU_3 --num_classes 9 --cuda_device 0
One-to-one transfer (such as CWRU operation condition 0 to condition 1).
python train.py --model_name CNN --source_name CWRU_0 --target_name CWRU_1 --train_mode single_source --num_classes 9 --cuda_device 0
Many-to-one transfer.
python train.py --model_name MFSAN --source_name CWRU_0,CWRU_1 --target_name CWRU_2 --train_mode multi_source --num_classes 9 --cuda_device 0
One-to-one transfer.
python train.py --model_name CNN --source_name CWRU --target_name MFPT --train_mode single_source --num_classes 3 --cuda_device 0
Many-to-one transfer.
python train.py --model_name MFSAN --source_name CWRU,PU --target_name MFPT --train_mode multi_source --num_classes 3 --cuda_device 0
If you have any problem with our code or have some suggestions, feel free to contact Jinyuan Zhang ([email protected]) or describe it in Issues.
If you use this toolbox or benchmark in your research, please cite this project.
@misc{dafd,
author = {Jinyuan Zhang},
title = {TL-Bearing-Fault-Diagnosis},
year = {2022},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/Feaxure-fresh/Domain-Adaptation-Fault-Diagnosis}},
}