Git Product home page Git Product logo

vibration_gan's Introduction

vibration_gan

Gan for time series vibration signals generation task, to enhance classification accuracy of fault diagnosis model under imbalanced training data.

personal undergraduate thesis

dataset

CWRU bearning data download

environment setup

  • python 3.x
  • tensorflow 1.15
  • keras
  • sklearn
  • matplotlib
  • numpy

data generation

  • train gan with limited target signals:
$ python train_gan.py --phase='train' --GAN_type='WGAN-GP' --target='B007' --imbalance_ratio=50
  • generate target signals with pretrained gan:
$ python train_gan.py --phase='generate' --checkpoint_dir=which-pretrained-model-in-checkpoint-dir --target='B007' --imbalance_ratio=50

data evaluation

  • use mmd.py to compare the difference between real data and generated data
  • use tsne.py to get visualization result
  • use fault_diagnosis.py to train diagnosis model with balanced dataset (generated by oversampling method - 'GAN', 'SMOTE', 'ADASYN','RANDOM')
$ python fault_diagnosis.py --imbalance_ratio=50 --oversampling_method='GAN' --generated_data_dir='\generated_data\ORDER_minmax_ratio50'
  • compare GAN with other oversampling method
$ python fault_diagnosis.py --imbalance_ratio=50 --oversampling_method='ADASYN' 
  • just train diagnosis model with balanced real dataset
$ python fault_diagnosis.py --imbalance_ratio=1 --oversampling_method='none' 

reference

DCGAN_WGAN_WGAN-GP_LSGAN_SNGAN_RSGAN_BEGAN_ACGAN_PGGAN_TensorFlow

Keras_bearing_fault_diagnosis

vibration_gan's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vibration_gan's Issues

generate target signals with pretrained gan: $ python train_gan.py --phase='generate' --checkpoint_dir=which-pretrained-model-in-checkpoint-dir --target='B007'

Sorry to bother you again.
When i changed 'train' to ‘generate',and the '--checkpoint_dir=which-pretrained-model-in-checkpoint-dir' becomed 'parser.add_argument('--checkpoint_dir', type=str, default='samples\WGAN-GP\ORDER\ratio-50\orderB007-05-17-20_22\checkpoint\model-97000', help='the saved checkpoint to generate signals')',but i meet the error :UnboundLocalError: local variable 'samples_dir' referenced before assignment.Is it the problem that I modified?
At the same time, I really won't change it'--checkpoint_dir=which-pretrained-model-in-checkpoint-dir'.

When I run fault_diagnosis.py, I meet the following problem, ask for the solution, thank you.

D:\anaconda\envs\tensorflow1.14\python.exe D:/daima/gan/vibration_gan-master/vibration_gan-master/fault_diagnosis.py
Using TensorFlow backend.
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
D:\anaconda\envs\tensorflow1.14\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
训练样本维度: (5000, 896, 1)
5000 训练样本个数
验证样本的维度 (2500, 896, 1)
2500 验证样本个数
测试样本的维度 (2500, 896, 1)
2500 测试样本个数
WARNING:tensorflow:From D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\backend\tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\backend\tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\backend\tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\backend\tensorflow_backend.py:148: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\backend\tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

Traceback (most recent call last):
File "D:/daima/gan/vibration_gan-master/vibration_gan-master/fault_diagnosis.py", line 130, in
model.load_weights('diagnosis_CWRU_model/order-50-0.71-best.hdf5')
File "D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\engine\saving.py", line 458, in load_wrapper
return load_function(*args, **kwargs)
File "D:\anaconda\envs\tensorflow1.14\lib\site-packages\keras\engine\network.py", line 1208, in load_weights
with h5py.File(filepath, mode='r') as f:
File "D:\anaconda\envs\tensorflow1.14\lib\site-packages\h5py_hl\files.py", line 427, in init
swmr=swmr)
File "D:\anaconda\envs\tensorflow1.14\lib\site-packages\h5py_hl\files.py", line 190, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 96, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = 'diagnosis_CWRU_model/order-50-0.71-best.hdf5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

Process finished with exit code 1

please help

1.About the file: samples\ wgan-gp \ORDER\ race-50 \ orderir021-05-17-20_23 \ w-ratio50-order-minmax-or021_98331. out, How is it generated?My run results did not.
2.According to the instructions of "README.md"
$ python train_gan.py --phase='generate' --checkpoint_dir=which-pretrained-model-in-checkpoint-dir --target='B007' --imbalance_ratio=50
About some code changes, how is "--checkpoint_dir=which-pretrained-model-in-checkpoint-dir " changed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.