如何从文本文件中对加速度计数据进行分类?

时间:2018-06-06 18:54:48

标签: python-3.x keras detection rnn

我有传感器数据的文本文件(x_train),例如加速度计:

# (patient number, time in ms, normalization of X Y and Z,
# kurtosis, skewness, pitch, roll and yaw, label) respectively.
1,15,-0.248010047716,0.00378335508419,-0.0152548459993,-86.3738760481,0.872322164158,-3.51314800063,0
1,31,-0.248010047716,0.00378335508419,-0.0152548459993,-86.3738760481,0.872322164158,-3.51314800063,0
1,46,-0.267422664673,0.0051143782875,-0.0191247001961,-85.7662354031,1.0928406847,-4.08015176908,0
1,62,-0.267422664673,0.0051143782875,-0.0191247001961,-85.7662354031,1.0928406847,-4.08015176908,0

我正在研究一种带有keras的深度学习模型RNN-LSTM 我试图检测患者是否处于FOG(步态冻结)阶段

下图是我想从加速度计信号文件中确定的块。

figure

,这是x轴,y轴和z轴 enter image description here

y-axis

z-axis

我现在遇到的问题是,我无法弄清楚如何以编程方式获取这些块。

而且我基本上想要的是知道患者在特定时间窗口内患FOG或走路的频率。 (窗口大小约为3秒)。

这是我试过的

def rwindows(a, window):

    shape = a.shape[0] - window + 1, window, a.shape[-1]
    strides = (a.strides[0],) + a.strides
    windows = np.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
    return np.squeeze(windows)

s=x_train.reshape(-1,6)
print(rwindows(s,3))

我需要获得雾和行走时信号之间的差异

0 个答案:

没有答案