Skip to content

Feaxure-fresh/TL-Bearing-Fault-Diagnosis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transfer Learning for Fault Diagnosis

Overview

Welcome to our repository dedicated to advancing the field of cross-domain fault diagnosis through transfer learning. Our focus lies in Single-source Unsupervised Domain Adaptation (SUDA), Multi-source Unsupervised Domain Adaptation (MUDA) and Domain Generalization (DG), offering a rich collection of resources and methods.

Featured Methods

Our repository includes a diverse range of state-of-the-art methods, each accompanied by relevant publications and direct access to implementation code in models. Highlights include:

Domain Adaptation

Domain Generalization

Getting Started

Requirements

Our code runs fine with the following prerequisites:

  • Python 3 (>=3.8)
  • Pytorch (>=1.10)
  • Numpy (>=1.21.2)
  • Pandas (>=1.5.3)
  • tqdm (>=4.46.1)
  • Scipy (>=1.10)

Repository Access

You can access our repository either by direct download or using git clone. Here’s how:

Direct Download

  1. Click on the 'Code' button and select 'Download ZIP'.
  2. Extract the ZIP file to your desired location.

Using Git Clone

  1. Open your command line interface.
  2. Navigate to the directory where you wish to clone the repository.
  3. Run the command:
git clone https://github.com/Feaxure-fresh/TL-Bearing-Fault-Diagnosis.git

Accessing Datasets

Supported datasets

Our repository supports several public datasets for fault diagnosis, with accompanying loading code. These include:

  • 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.

Setting Up Dataset Directory

  • Create a folder named "datasets" in the root directory of the cloned repository.
  • Download the desired datasets and place them into this "datasets" folder, follow the steps below:

Within-dataset Transfer

For analyzing a specific dataset under different working conditions:

  1. Divide the dataset into separate folders named "condition_0", "condition_1", etc., each representing a unique operational condition.
  2. Within each "condition_?" folder, create subfolders (with custom names) for different fault categories containing the respective fault data.
  3. Ensure each 'condition_?' folder contains subfolders with identical names and numbers (indicating the same classes of faults).

For example, for the CWRU dataset:

  • Organize the dataset into folders based on motor speed (four speeds as four folders).
  • Within each condition folder, categorize data into 9 subfolders for 9 fault classes, such as '7 mil Inner Race fault', '14 mil Inner Race fault', '7 mil Outer Race fault', etc., as detailed in Table XII of this IEEE article.

Example folder structure for CWRU dataset:

.
└── datasets
    └── CWRU
        ├── condition_0
        │   ├── ball_07
        │   │   └── 122.mat
        │   ├── inner_07
        │   │   └── 109.mat
        │   ...
        ├── condition_1
        │   ├── ball_07
        │   │   └── 123.mat
        │   ...
        ├── condition_2
        ...

Cross-dataset Transfer

For implementing transfer between different datasets:

  1. Organize the dataset into multiple folders according to fault categories across at least two datasets.
  2. Maintain consistency in folder names and numbers across all datasets.

For instance, when organizing CWRU and MFPT datasets for one-to-one transfer:

.
└── datasets
    ├── CWRU
    │   ├── inner
    |   |    ├── ***.mat
    |   |    |   ***.mat
    |   |    ...
    │   ├── normal
    │   └── outer
    └── MFPT
        ├── inner
        ├── normal
        └── outer

🌟 Still confused about the dataset setup? Please refer to the sample datasets provided in this repository.

Custom Dataset Integration

For incorporating other public datasets or your custom datasets, navigate to data_loader/load_methods.py in the repository. Implement your data loading function following this template:

def your_dataset_name(item_path):
    # Your code to extract the signal or data from the file
    signal = take_out_data_from_file(item_path)
    return signal

This process allows for the seamless integration within our framework.

Training Procedures

Within-dataset transfer

Train models using data from the same dataset but different operational conditions.

One-to-One Transfer

Example: Transfer from CWRU operation condition 0 to condition 1.

python train.py --model_name DAN --source CWRU_0 --target CWRU_1 --train_mode single_source --cuda_device 0

Many-to-One Transfer

Example: Transfer from CWRU operation condition 0 and condition 1 to condition 2.

python train.py --model_name MFSAN --source CWRU_0,CWRU_1 --target CWRU_2 --train_mode multi_source --cuda_device 0 

Cross-dataset transfer

Train models using data from different datasets.

One-to-One Transfer

Example: Transfer from CWRU to MFPT dataset.

python train.py --model_name DAN --source CWRU --target MFPT --train_mode single_source --cuda_device 0

Many-to-One Transfer

Example: Transfer from CWRU and PU datasets to MFPT dataset.

python train.py --model_name MFSAN --source CWRU,PU --target MFPT --train_mode multi_source --cuda_device 0

Load trained weights

Load and utilize weights from previously trained models.

Example: Load weights and test on CWRU operation condition 3.

python train.py --model_name MFSAN --load_path ./ckpt/MFSAN/multi_source/**.pth --source CWRU_0,CWRU_1 --target CWRU_3 --cuda_device 0

NOTE: The --source flag is not necessary for some models when loading weights for testing. However, for certain models, the number of sources is required to define the model structure, and the specific sources used are not important in this context.

🛠️ For more experimental settings, please modify the arguments in opt.py.

Contact

We welcome feedback, inquiries, and suggestions to improve our work. If you encounter any issues with our code or have recommendations, please don't hesitate to reach out. You can contact Jinyuan Zhang via email at feaxure@outlook.com, or alternatively, feel free to post your queries or suggestions in the Issues section of our GitHub repository.

Citation

Your support in citing our project when used in your research is highly appreciated. It helps in the recognition and dissemination of our work. Please use the following citation format:

@misc{TL-Bearing-Fault-Diagnosis,
    author = {Jinyuan Zhang},
    title = {TL-Bearing-Fault-Diagnosis},
    year = {2022},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{https://github.com/Feaxure-fresh/TL-Bearing-Fault-Diagnosis}}
}

About

Bearing Fault Diagnosis Employing Transfer Learning Techniques: Domain Adaptation and Domain Generalization

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages