感谢我亲爱的导师发表的论文 心电信号分类论文 非常具有创新性和应用性。
这些是别人大佬对convit模型的解释 https://www.frontiersin.org/journals/cardiovascular-medicine/articles/10.3389/fcvm.2022.983543/full
大佬对TSST的解释 https://blog.youkuaiyun.com/m0_60703264/article/details/133779671
我按照导师里面的提到的数据库 心电信号数据库 MIT-BIH Arrhythmia Database v1.0.0 下载的数据文件(通常包括 .dat、.hea 文件及注释文件)。
这个是我用代码 获取的 一个完整的病例编号100的一个完整的时序心电信号图,其中有红色虚线的是被标注的地方。
这段代码是将 数据库里面的 数字信号 过滤降噪后 得到心电图的片段
import wfdb
import numpy as np
import matplotlib.pyplot as plt
import os
# 读取 ECG 数据和标注
def load_record(record_id='100'):
record = wfdb.rdrecord(f'D:\\QT_item\\Statistial_modeling\\shujuji\\mit-bih-arrhythmia-database-1.0.0/{record_id}')
annotation = wfdb.rdann(f'D:\\QT_item\\Statistial_modeling\\shujuji\\mit-bih-arrhythmia-database-1.0.0/{record_id}', 'atr')
return record, annotation
# 带通滤波(降噪)
def bandpass_filter(signal_data, lowcut=0.5, highcut=40.0, fs=360, order=4):
from scipy.signal import butter, filtfilt
nyquist = 0.5 * fs
low = lowcut / nyquist
high = highcut / nyquist
b, a = butter(order, [low, high], btype='band')
return filtfilt(b, a, signal_data)
# 处理 ECG 数据并分类存储
def preprocess_and_classify(record_id='100', window_size=300):
record, annotation = load_record(record_id) #该函数返回 ECG 信号 (record) 和 标注信息 (annotation),用于后续分析。
ecg_signal = record.p_signal[:, 0] # 选取第一个通道
filtered_ecg = bandpass_filter(ecg_signal) # 过滤
labels = annotation.symbol # 获取疾病标注