Post

心音数据集 —— 健康 or 异常二分类

心音数据集 —— 健康 or 异常二分类

心音数据集 —— 健康 or 异常二分类

1. Classification of Heart Sound Signal Using Multiple Features

https://github.com/yaseen21khan/Classification-of-Heart-Sound-Signal-Using-Multiple-Features-

  • 音频数量:1000,200正常 + 800异常
  • 类别划分:5类,每类200条
    • 正常:N
    • 主动脉狭窄:AS
    • 二尖瓣反流:MR
    • 二尖瓣狭窄:MS
    • 二尖瓣脱垂:MVP
  • 采样率:8000HZ

2. BMD-HS-Dataset(BUET)

https://github.com/mHealthBuet/BMD-HS-Dataset

  • 音频数量:864条心音记录,涵盖59名患者的8个胸部位置录音,每条持续20秒,采样率4kHZ
    • 健康:168条
    • 患病:695条
  • 类别划分:6类,每条可同时归属于多个类别
    • N,AS,MR,MS
    • 主动脉返流:AR
    • 多瓣病:MD
  • 每条录音伴随年龄、性别、是否吸烟、城乡居住等附加信息

3. PeterJ.Bentley-heartchallenge(取健康音频)

https://istethoscope.peterjbentley.com/heartchallenge/index.html

  • Dataset A: iPhone用户使用iStethoscope Pro App收集的心音,包含背景噪声与真实应用场景
    • 176条,采样率4kHZ
      • N(31条)
      • 杂音: Murmur
      • 额外心音: Extra Heart Sound
      • 伪影: Artifact
  • Dataset B: 临床环境中使用DigiScope数据听诊器采集,环境相对专业,噪声较低
    • 656条,采样率4kHZ
      • N(320条),Murmur
      • 期外收缩:Extrasystole
  • 录音时长1s-30s不等

  • 总462(?)条正常

4. PhysioNet/CinC Challenge 2016

https://physionet.org/content/challenge-2016/1.0.0/

  • 音频总数:正常总数665条,异常总数2575
  • 录音时长:5s-120s
  • 采样率:2000HZ
  • 类别划分: 超过1000名受试者,包括成人与儿童; 环境多样,包括医院、家庭访问,具有真实噪声背景

    • 正常: Normal
    • 异常: Abnormal
  • 噪声过多无法判断:Unsure

5. normal

通过耳机录制的心音,均为健康样本,共96条。


6. Heartbeat-Sounds(取健康音频)

https://www.kaggle.com/datasets/kinguistics/heartbeat-sounds

  • 151条正常

7. CirCor DigiScope(取健康音频)

https://physionet.org/content/circor-heart-sound/1.0.3/

  • 健康:2358
  • 异常:606

总健康心音数:4100

总患病心音数:4676

alt text


数据集统一处理

clean_data.py

  • 统一读取7个来源的数据集,0正常,1异常

  • 训练集:验证集:测试集 = 7:1:2

  • 音频数据:
    • 立体声,则仅保留一个声道;
    • 重采样至16kHz;
    • 带通滤波:20 ~ 400 Hz;
    • 裁剪、填充至10s;
    • 数据增强:
      • 随机遮蔽1600点:30%;
      • 加入轻微高斯噪声:30%;
      • 音量随机缩放:30%;
    • 保存为.npy
  • 三通道RGB谱图:

    • 重采样至3kHz;

    • 随机裁剪、填充至8s,总计24000个采样点;

    • 双谱图 —— R通道

      使用现成的polycoherence工具

      https://github.com/trichter/polycoherence

      1
      2
      3
      4
      5
      6
      7
      
      def compute_bispectrum(y, sr=1000):
          y = y[:2500]
          f1, f2, bi_spectrum = polycoherence(y, fs=sr, nfft=512, nperseg=128, noverlap=96, norm=None)
          bi_spectrum = np.log1p(np.abs(bi_spectrum))
          bi_spectrum = np.power(bi_spectrum, 0.5)
          bi_spectrum = (bi_spectrum - bi_spectrum.min()) / (bi_spectrum.max() - bi_spectrum.min() + 1e-9)
          return bi_spectrum
      
    • 短时傅里叶变化(STFT) —— G通道

      1
      2
      3
      4
      5
      6
      7
      
      def compute_stft(y, sr=1000):
          f, t, Zxx = stft(y, fs=sr, nperseg=128)
          S = np.abs(Zxx)
          S = np.log1p(S)
          S = np.power(S, 0.7)
          S = (S - S.min()) / (S.max() - S.min() + 1e-9)
          return S
      
    • 梅尔频率倒谱系数(MFCC) —— B通道

      1
      2
      3
      4
      5
      
      def compute_mfcc(y, sr=1000):
          mfcc = librosa.feature.mfcc(y=y, sr=sr, n_mfcc=40)
          mfcc = np.log1p(np.abs(mfcc))
          mfcc = (mfcc - mfcc.min()) / (mfcc.max() - mfcc.min() + 1e-9)
          return mfcc
      
    • 裁剪函数

      1
      2
      3
      4
      5
      
      def crop_center(img, crop_size=128):
          h, w = img.shape
          top = max((h - crop_size) // 2, 0)
          left = max((w - crop_size) // 2, 0)
          return img[top:top + crop_size, left:left + crop_size]
      
    • 将三个通道的图谱进行裁剪,随后堆叠合并为RGB图像,即为最终图像模型的训练数据,如下为例:

      alt text

最终文件夹结构:

alt text

aug_data: 音频对应npy

bispec_output: RGB谱图

netadata: 图像与音频对应关系


This post is licensed under CC BY 4.0 by the author.