引言
旋转机械故障诊断挑战赛是一项旨在提高旋转机械故障检测和识别能力的竞赛活动。旋转机械是工业生产中广泛应用的设备,其运行状态直接影响着生产效率和安全性。然而,由于各种原因,旋转机械可能会出现不同类型的故障,如轴承损坏、齿轮磨损、转子不对中等。这些故障会导致设备性能下降甚至停机,给企业带来巨大的经济损失和安全风险。因此,及时准确地诊断旋转机械的故障类型,对于保证设备正常运行和延长设备寿命具有重要意义。本博客针对科大讯飞旋转机械故障诊断挑战赛提供的振动和噪声数据集,构建并测试了深度学习和时频分析方法在这一赛事上的可行性。
科大讯飞-旋转机械故障诊断挑战赛2023-测试【1】
- 1. 赛事任务简介
- 2. 不同类型数据的可视化测试
- 3. 生成的时频数据集测试
- 4. 训练测试
- 5. 参考资料
1. 赛事任务简介
本赛事任务是:基于科大讯飞以及国家智能语音创新中心提供的转子综合故障模拟实验台数据集,构建故障诊断模型,利用振动及声音数据对外圈点蚀、滚动体点蚀、转子不对中等故障进行检测。
2. 不同类型数据的可视化测试
首先,遍历读取下不同工况下的数据,看下其频谱情况
# create a figure with 1 row and 5 columns of subplots
fig, axs = plt.subplots(5, 5, figsize=(15, 10))
###########################################################################################################
# iterate over each file and plot its spectrogram on a different subplot (Cage)
for i, file in enumerate(file_list1):
y, sr = librosa.load(os.path.join(path1, file), duration=2)
S = librosa.feature.melspectrogram(y=y, sr=sr, n_mels=128,
fmax=8000)
S_dB = librosa.power_to_db(S, ref=np.max)
librosa.display.specshow(S_dB, x_axis='time',
y_axis='mel', sr=sr,
fmax=8000, ax=axs[0,i])
axs[0,i].set_title(f'Cage {i+1}')
3. 生成的时频数据集测试
循环遍历生成所需的数据
# 单个信号读取生成TF图像
def single_TF_gen(root_path, save_path):
ful_name = root_path
fs = 5120
fmax = 2048
mat_data = scipy.io.loadmat(ful_name)
vib_data = mat_data['vib_data'].flatten()
S = librosa.feature.melspectrogram(y=vib_data, sr=fs, n_mels=128,
fmax=fmax)
S_dB = librosa.power_to_db(S, ref=np.max)
librosa.display.specshow(S_dB, x_axis='time',
y_axis='mel', sr=fs,
fmax=fmax)
plt.axis('off')
plt.tight_layout()
tail_name = ful_name.split("\\")[-1]
new_name = tail_name.split(".")[0]+".png"
root_new_name = os.path.join(save_path, new_name)
plt.savefig(root_new_name)
4. 训练测试
这里随便构建了一个简单的MobileNetv2轻量级深度卷积模型测试了一下
model = torchvision.models.mobilenet_v2(weights=True, progress=False)
num_classes = 3
# 提取fc层中固定的参数
num_ftrs = model.classifier[1].in_features
model.classifier = nn.Sequential(
# nn.Dropout(0.3),
nn.Linear(num_ftrs, num_classes),
)
输入数据resize到了128x128的大小,测试224x224的时候爆显存了,, 训练日志如下:
训练集数据量:2400, 验证集数据量:2400,测试集数据量:290
tran_tensor:(2400, 3, 144, 144);val_tensor:(2400, 3, 144, 144)
Epoch: 1 Training Loss: 1.862576
Epoch: 1 Validation Loss: 5.066102, Accuracy: 0.220417
Model saved with validation accuracy: 0.2204
Epoch: 2 Training Loss: 1.293744
Epoch: 2 Validation Loss: 2.639574, Accuracy: 0.300417
Model saved with validation accuracy: 0.3004
Epoch: 3 Training Loss: 0.800851
Epoch: 3 Validation Loss: 2.994601, Accuracy: 0.238333
Epoch: 4 Training Loss: 0.788063
Epoch: 4 Validation Loss: 3.860251, Accuracy: 0.323333
Model saved with validation accuracy: 0.3233
Epoch: 5 Training Loss: 0.357117
Epoch: 5 Validation Loss: 4.141068, Accuracy: 0.196250
Epoch: 6 Training Loss: 0.173838
Epoch: 6 Validation Loss: 4.505919, Accuracy: 0.297083
Epoch: 7 Training Loss: 0.103274
Epoch: 7 Validation Loss: 3.654365, Accuracy: 0.272500
Epoch: 8 Training Loss: 0.412588
Epoch: 8 Validation Loss: 4.739330, Accuracy: 0.219167
Epoch: 9 Training Loss: 0.147426
Epoch: 9 Validation Loss: 3.770333, Accuracy: 0.227500
Epoch: 10 Training Loss: 0.118514
Epoch: 10 Validation Loss: 5.433824, Accuracy: 0.225000
Epoch: 11 Training Loss: 0.075598
Epoch: 11 Validation Loss: 4.303043, Accuracy: 0.240417
Epoch: 12 Training Loss: 0.374948
Epoch: 12 Validation Loss: 4.233840, Accuracy: 0.397500
Model saved with validation accuracy: 0.3975
Epoch: 13 Training Loss: 0.076623
...
效果勉勉强强吧,能排到个70名,哈哈哈,后面有时间再想想怎么优化优化😸😸😸
5. 参考资料
【1】科大讯飞-旋转机械故障诊断挑战赛2023