滚动轴承振动信号异常检测方法总结(NASA-IMS轴承数据,Python)

news2024/10/5 19:15:25

之前的文章:

基于自编码器的滚动轴承异常检测方法(NASA-IMS轴承数据,Python)

基于单类支持向量机的滚动轴承异常检测方法(NASA-IMS轴承数据,Python)

基于主成分分析的滚动轴承异常检测方法(NASA-IMS轴承数据,Python)

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.io as sio
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
signals_test2_channels = sio.loadmat('signals_test2_channels.mat')
Ch1_test2 = signals_test2_channels['Ch1']
Ch1_test2 = Ch1_test2[0]
signal_duration_test2 = 9840
nfiles_test2 = 984
onset_anomalies_PCA_GMM_Ch1 = (signal_duration_test2 - 2820)
onset_anomalies_PCA_ZS_Ch1 = (signal_duration_test2 - 3720)
onset_anomalies_Autoencoder_GMM_Ch1 = (signal_duration_test2 - 2820)
onset_anomalies_Autoencoder_ZS_Ch1 = (signal_duration_test2 - 2810)
onset_anomalies_OCSVM = (signal_duration_test2 - 3760)
t_test2 =  np.linspace(0, signal_duration_test2, len(Ch1_test2))
fig, ax = plt.subplots()
axins = inset_axes(ax, 2, 2 , loc=1, bbox_to_anchor=(0.01, 0.35), bbox_transform=ax.figure.transFigure)
axins2 = inset_axes(ax, 2, 2 , loc=2, bbox_to_anchor=(1.05, 0.35), bbox_transform=ax.figure.transFigure)


ax.plot(t_test2, Ch1_test2, alpha = 0.7)
ax.axvline(onset_anomalies_PCA_GMM_Ch1, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
ax.axvline(onset_anomalies_PCA_ZS_Ch1, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
ax.axvline(onset_anomalies_Autoencoder_GMM_Ch1, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
ax.axvline(onset_anomalies_Autoencoder_ZS_Ch1, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
ax.axvline(onset_anomalies_OCSVM, color = '#FFC300', linestyle='--', label = 'OCSVM')


axins.plot(t_test2, Ch1_test2,  alpha = 0.7)
axins.axvline(onset_anomalies_PCA_GMM_Ch1, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
axins.axvline(onset_anomalies_PCA_ZS_Ch1, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
axins.axvline(onset_anomalies_Autoencoder_GMM_Ch1, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
axins.axvline(onset_anomalies_Autoencoder_ZS_Ch1, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
axins.axvline(onset_anomalies_OCSVM, color = '#FFC300', linestyle='--', label = 'OCSVM')


axins2.plot(t_test2, Ch1_test2,  alpha = 0.7)
axins2.axvline(onset_anomalies_PCA_GMM_Ch1, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
axins2.axvline(onset_anomalies_PCA_ZS_Ch1, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
axins2.axvline(onset_anomalies_Autoencoder_GMM_Ch1, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
axins2.axvline(onset_anomalies_Autoencoder_ZS_Ch1, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
axins2.axvline(onset_anomalies_OCSVM, color = '#FFC300', linestyle='--', label = 'OCSVM')


x1, x2, y1, y2 = 6070, 6130, -1, 1 
axins.set_xlim(x1, x2) 
axins.set_ylim(y1, y2) 


x1, x2, y1, y2 = 7010, 7050, -1, 1 
axins2.set_xlim(x1, x2) 
axins2.set_ylim(y1, y2) 
axins2.annotate('PCA-GMM', xy=(7020, 0.4), xytext=(7032, 0.8),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins2.annotate('Aut.-GMM', xy=(7020, -0.2), xytext=(7032, 0.2),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins2.annotate('Aut.-Z-Scores', xy=(7030, -0.8), xytext=(7032, -0.4),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


axins.annotate('PCA-Z-Scores', xy=(6120, -0.8), xytext=(6085, -0.3),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins.annotate('OCSVM', xy=(6080, 0), xytext=(6100, 0.5),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


mark_inset(ax, axins, loc1=1, loc2=2, fc="none", ec="0.5")
mark_inset(ax, axins2, loc1=1, loc2=2, fc="none", ec="0.5")


ax.set_xlabel('Time (min)')
ax.set_ylabel('Amplitude')
ax.set_title('Ch1 - test2')


axins.set_xlabel('Time (min)')
axins.set_ylabel('Amplitude')


axins2.set_xlabel('Time (min)')
axins2.set_ylabel('Amplitude')


ax.legend()

signals_test1_channels = sio.loadmat('signals_test1_channels.mat')
Ch5_test1 = signals_test1_channels['Ch5']
Ch6_test1 = signals_test1_channels['Ch6']
Ch5_test1 = Ch5_test1[0]
Ch6_test1 = Ch6_test1[0]
signal_duration_test1 = 43 * 5 + (2156 - 43) * 10
nfiles_test1 = 2156
onset_anomalies_PCA_GMM_Ch5 = (signal_duration_test1 - 3320)
onset_anomalies_PCA_ZS_Ch5 = (signal_duration_test1 - 3320)
onset_anomalies_Autoencoder_GMM_Ch5 = (signal_duration_test1 - 3350)
onset_anomalies_Autoencoder_ZS_Ch5 = (signal_duration_test1 - 3350)
onset_anomalies_OCSVM_Ch5 = (signal_duration_test1 - 3350) 


onset_anomalies_PCA_GMM_Ch6 = (signal_duration_test1 - 2820) 
onset_anomalies_PCA_ZS_Ch6 = (signal_duration_test1 - 3720)
onset_anomalies_Autoencoder_GMM_Ch6 = (signal_duration_test1 - 3310)
onset_anomalies_Autoencoder_ZS_Ch6 = (signal_duration_test1 - 3310)
onset_anomalies_OCSVM_Ch6 = (signal_duration_test1 - 4350)
t_test1 =  np.linspace(0, signal_duration_test1, len(Ch5_test1))
fig, ax = plt.subplots()
axins = inset_axes(ax, 2, 2 , loc=1, bbox_to_anchor=(1.5, 0.35), bbox_transform=ax.figure.transFigure)


ax.plot(t_test1, Ch5_test1, alpha = 0.7)
ax.axvline(onset_anomalies_PCA_GMM_Ch5, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
ax.axvline(onset_anomalies_PCA_ZS_Ch5, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
ax.axvline(onset_anomalies_Autoencoder_GMM_Ch5, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
ax.axvline(onset_anomalies_Autoencoder_ZS_Ch5, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
ax.axvline(onset_anomalies_OCSVM_Ch5, color = '#FFC300', linestyle='--', label = 'OCSVM')


axins.plot(t_test1, Ch5_test1, alpha = 0.7)
axins.axvline(onset_anomalies_PCA_GMM_Ch5, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
axins.axvline(onset_anomalies_PCA_ZS_Ch5, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
axins.axvline(onset_anomalies_Autoencoder_GMM_Ch5, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
axins.axvline(onset_anomalies_Autoencoder_ZS_Ch5, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
axins.axvline(onset_anomalies_OCSVM_Ch5, color = '#FFC300', linestyle='--', label = 'OCSVM')


x1, x2, y1, y2 = 17895, 18100, -1, 1 
axins.set_xlim(x1, x2) 
axins.set_ylim(y1, y2) 


mark_inset(ax, axins, loc1=1, loc2=2, fc="none", ec="0.5")
axins.annotate('OCSVM', xy=(17990, 0.4), xytext=(17900, 0.7),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )      
axins.annotate('Aut.-GMM', xy=(17990, -0.3), xytext=(17900, 0.1),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins.annotate('Aut.-Z-Scores', xy=(17990, -0.9), xytext=(17900,-0.5),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


axins.annotate('PCA-GMM', xy=(18025, 0.4), xytext=(18035, 0.7),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )      
axins.annotate('PCA-Z-Scores', xy=(18025, -0.3), xytext=(18035, 0.1),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


ax.set_xlabel('Time (min)')
ax.set_ylabel('Amplitude')
ax.set_title('Ch5 - test1')
#ax.axes.xaxis.set_ticks([])


axins.set_xlabel('Time (min)')
axins.set_ylabel('Amplitude')
#axins.axes.xaxis.set_ticks([])


ax.legend()

fig, ax = plt.subplots()
axins = inset_axes(ax, 2, 2 , loc=1, bbox_to_anchor=(1.5, 0.35), bbox_transform=ax.figure.transFigure)


ax.plot(t_test1, Ch6_test1, alpha = 0.7)
ax.axvline(onset_anomalies_PCA_GMM_Ch6, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
ax.axvline(onset_anomalies_PCA_ZS_Ch6, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
ax.axvline(onset_anomalies_Autoencoder_GMM_Ch6, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
ax.axvline(onset_anomalies_Autoencoder_ZS_Ch6, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
ax.axvline(onset_anomalies_OCSVM_Ch6, color = '#FFC300', linestyle='--', label = 'OCSVM')


axins.plot(t_test1, Ch6_test1, alpha = 0.7)
axins.axvline(onset_anomalies_PCA_GMM_Ch6, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
axins.axvline(onset_anomalies_PCA_ZS_Ch6, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
axins.axvline(onset_anomalies_Autoencoder_GMM_Ch6, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
axins.axvline(onset_anomalies_Autoencoder_ZS_Ch6, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
axins.axvline(onset_anomalies_OCSVM_Ch6, color = '#FFC300', linestyle='--', label = 'OCSVM')


x1, x2, y1, y2 = 18000, 18100, -1, 1 
axins.set_xlim(x1, x2) 
axins.set_ylim(y1, y2) 


mark_inset(ax, axins, loc1=1, loc2=2, fc="none", ec="0.5")     
axins.annotate('Aut.-GMM', xy=(18035, 0.2), xytext=(18045, 0.7),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins.annotate('Aut.-Z-Scores', xy=(18035, -0.7), xytext=(18045,-0.2),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


ax.set_xlabel('Time (min)')
ax.set_ylabel('Amplitude')
ax.set_title('Ch6 - test1')


axins.set_xlabel('Time (min)')
axins.set_ylabel('Amplitude')


ax.legend()

fig, ax = plt.subplots()
axins = inset_axes(ax, 2, 2 , loc=1, bbox_to_anchor=(1.5, 0.35), bbox_transform=ax.figure.transFigure)


ax.plot(t_test1, Ch5_test1, alpha = 0.7)
ax.axvline(onset_anomalies_PCA_GMM_Ch5, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
ax.axvline(onset_anomalies_PCA_ZS_Ch5, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
ax.axvline(onset_anomalies_Autoencoder_GMM_Ch5, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
ax.axvline(onset_anomalies_Autoencoder_ZS_Ch5, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
ax.axvline(onset_anomalies_OCSVM_Ch5, color = '#FFC300', linestyle='--', label = 'OCSVM')


axins.plot(t_test1, Ch5_test1, alpha = 0.7)
axins.axvline(onset_anomalies_PCA_GMM_Ch5, color = '#6A0A2F', linestyle='--', label = 'PCA - GMM')
axins.axvline(onset_anomalies_PCA_ZS_Ch5, color = '#6A0A2F', linestyle=':', label = 'PCA - Z-Scores')
axins.axvline(onset_anomalies_Autoencoder_GMM_Ch5, color = '#FF5733', linestyle='--', label = 'Autoencoder - GMM')
axins.axvline(onset_anomalies_Autoencoder_ZS_Ch5, color = '#FF5733', linestyle=':', label = 'Autoencoder - Z-Scores')
axins.axvline(onset_anomalies_OCSVM_Ch5, color = '#FFC300', linestyle='--', label = 'OCSVM')


x1, x2, y1, y2 = 17895, 18100, -1, 1 
axins.set_xlim(x1, x2) 
axins.set_ylim(y1, y2) 


mark_inset(ax, axins, loc1=1, loc2=2, fc="none", ec="0.5")
axins.annotate('OCSVM', xy=(17990, 0.4), xytext=(17900, 0.7),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )      
axins.annotate('Aut.-GMM', xy=(17990, -0.3), xytext=(17900, 0.1),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )
axins.annotate('Aut.-Z-Scores', xy=(17990, -0.9), xytext=(17900,-0.5),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


axins.annotate('PCA-GMM', xy=(18025, 0.4), xytext=(18035, 0.7),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )      
axins.annotate('PCA-Z-Scores', xy=(18025, -0.3), xytext=(18035, 0.1),
            arrowprops=dict(arrowstyle="-|>", connectionstyle="angle3,angleA=90,angleB=0")
            )


ax.set_xlabel('Time (min)')
ax.set_ylabel('Amplitude')
ax.set_title('Ch5 - test1')
#ax.axes.xaxis.set_ticks([])


axins.set_xlabel('Time (min)')
axins.set_ylabel('Amplitude')
#axins.axes.xaxis.set_ticks([])

知乎学术咨询:
https://www.zhihu.com/consult/people/792359672131756032?isMe=1
ax.legend()

擅长领域:现代信号处理,机器学习,深度学习,数字孪生,时间序列分析,设备缺陷检测、设备异常检测、设备智能故障诊断与健康管理PHM等。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1842351.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Python运算符重载,代码秒变高大上!

目录 1、运算符重载基础介绍 🧮 1.1 什么是运算符重载 1.2 为何使用运算符重载 1.3 Python中的特殊方法魔法 示例:重载加法运算符 2、实战:重载加法运算符 + 🧩 2.1 自定义类与__add__() 2.2 应用案例:复数加法 2.3 深入理解__add__方法 3、重载其他运算符示例…

js实现canvas截图功能

关键代码 使用canvas的导出功能和drawImage函数 class CropShape{cropShape(shape){let {x,y,w,h} shapeconsole.log(x,y,w,h)const roiCanvas document.createElement(canvas);document.getElementById(app).append(roiCanvas)const roiCtx roiCanvas.getContext(2d);roi…

如何选择理想CDN服务商来提升网站性能

在数字时代,网络速度已成为衡量网站成功的关键指标之一。快速加载的网站不仅提升用户体验,还对网站的搜索引擎排名产生显著影响。用户期望网站能够迅速响应其请求,而任何延迟都可能导致用户不满和流失。研究表明,网站加载时间的每…

【产品经理】订单处理6-审单方案

电商系统中订单管理员会对特殊类型的订单进行审核,普通订单则自动审核,本节讲述自动审单方案、手动审单以及加急审单。 一、自动审单 自动审单方案可按照方案形式制定,可一次性制定多套审单方案。 1. 审单通过条件有 执行店铺&#xff…

Python爬虫实战:淘宝商品爬取与数据分析

一、爬虫技术概述 爬虫技术是一种在互联网上自动收集信息的方法。通过编写程序,让计算机自动访问网站,获取所需数据,并进行分析和处理。Python作为一种功能强大、易于学习的编程语言,其爬虫库Scrapy更是爬虫技术的利器。 二、淘…

段码屏省电低功耗驱动芯片PC164S32|128点阵|低功耗LCD屏专用芯片

1 简介 PC164S32 是一款支持 128 点 (32 4)显示 的多功能 LCD 控制器芯片,内部存储器RAM数据直接映射到 LCD 显示。可软件配置特性使其适用于包括 LCD 模块和显示子系统在内的多种 LCD 应用。主控制器与 PC164S32接口仅需3 或 4 条线。内置的省电模式极大的降低了功…

LangChain入门到精通,看这这篇吊打面试官

导语 在人工智能领域的不断发展中,语言模型扮演着重要的角色。特别是大型语言模型(LLM),如ChatGPT,已经成为科技领域的热门话题,并受到广泛认可。在这个背景下,LangChain作为一个以LLM模型为核…

深度学习1 -- 开头

一 前言 感觉用这玩意越来越多,所以想学学。不过没想好怎么学,也没有提纲,买了两本书,一本是深度学习入门,小日子写的。还有一本就是花书。还有就是回Gatech参加线上课程,CS7643。 CS 7643: Deep Learnin…

ps 科研图文字变清晰

目录 网站 PS 网站 AI照片修复神器,一键模糊图片变清晰 (picwish.cn) PS 用PS快速将一张模糊不清晰的照片变清晰,简单5步就好 - 知乎 (zhihu.com) CrtlJ 滤镜 其他 高反差 半径调2 叠加

【机器学习300问】128、简述什么Word2Vec?

一、一句话说明Word2Vec是什么? Word2Vec是一种常见的词嵌入技术。Word2Vec的目标是将每个词表示为一个向量,使得这些向量能够反映出词语之间的相似性和关联性。 word2vec算法通过预测中心词和上下文词的共现概率来学习词向量,能够捕捉词语之…

LeetCode 338.比特位计数

各位朋友们,大家好啊,今天此题我用的方法比较好理解,但时间复杂度比较高如果大家觉得可以的话,不妨给个免费的赞吧,谢谢了^ _ ^ 1.题目要求如图所示: 2.做题步骤: 1.先计算总共多少个数: int count 0;int number 0;…

二叉树(数据结构篇)

数据结构之二叉树 二叉树 概念: 二叉树(binary tree)是一颗每个节点都不能多于两个子节点的树,左边的子树称为左子树,右边的子树称为右子树 性质: 二叉树实际上是图,二叉树相对于树更常用。 平衡二叉树的深度要比…

重磅!鹅厂大牛带你30分钟玩转AI智能结对编程!

在大模型时代,人工智能技术的突破性进展正重塑着软件开发的面貌。AI的融入不仅优化了代码编写过程,更开启了智能编程的新纪元,为开发者带来了前所未有的工作效率和创新可能。AI结对编程不仅能够极大提升研发效率,还能通过智能分析…

C++语法06 格式化输出及保留小数点后指定位数

格式化输出 格式化输出所用的函数为 printf,它可以输出任意位数的小数。 使用格式:printf(“%.nf”,a)。这句话的作用是将变量a保留n位小数输出。 注意事项: 1、这里的n,需要具体化为一个数字,保留几位小数&#x…

MathType软件7.7最新永久激活码许可证秘钥2024最新

【种草神器!】大家好啊,我刚刚发现了一个超级好用的工具,迫不及待地想跟大家分享——MathType软件的最新功能介绍。作为一个经常需要处理各种复杂数学公式和文档的科研狗🐶,找到一款好的数学编辑工具对我来说真的太重要…

如何防止三重勒索勒索软件?

您的数据被加密后,定期备份数据是一个很好的策略,可以避免支付赎金,但这并不意味着攻击者仍然无法占得上风。一些攻击者现在正转向三重勒索勒索软件攻击,扬言不仅要劫持您的数据,还要将这些信息泄露给公众。 这类勒索…

离子交换技术在单晶硅生产废水除氟项目中的应用研究

单晶硅是电子工业的重要基础材料,广泛应用于太阳能光伏、半导体等领域。然而,单晶硅的生产过程中使用了氢氟酸、氟化铵等大量含氟化学品,导致产生的废水中含有高浓度的氟化物。这些含氟废水若未经有效处理,直接排放到环境中&#…

爬虫学习。。。。

爬虫的概念: 爬虫是一种自动化信息采集程序或脚本,用于从互联网上抓取信息。 它通过模拟浏览器请求站点的行为,获取资源后分析并提取有用数据,这些数据可以是HTML代码、JSON数据或二进制数据(如图片、视频&#xff09…

CentOS Linux 7系统中离线安装MySQL5.7步骤

预计数据文件存储目录为:/opt/mysql/data 1、文件下载: 安装文件下载链接:https://downloads.mysql.com/archives/community/ 2、检查当前系统是否安装过MySQL [rootcnic51 mysql]# rpm -qa|grep mariadb mariadb-libs-5.5.68-1.el7.x86_6…

【机器学习】---无监督学习

引言 在机器学习的广阔领域中,无监督学习扮演着至关重要的角色。不同于有监督学习,无监督学习处理的是没有标签的数据集,即我们不知道每个数据点的正确答案或分类。然而,这并不意味着无监督学习无法为我们提供有价值的信息。相反…