使用什么算法将 2D 骨架练习动作分解为重复

问题描述 投票:0回答:1

我目前正在使用 MM-Fit 2D 骨骼数据集 2D Skeleton,由不同的练习组成。我想将练习分成几次。可以用什么算法来完成?

以下是数据集中其中一项操作的示例: https://imgur.com/a/kM6XIWa

python numpy math computer-vision
1个回答
0
投票

来自 @NickODells avice,我能够使用

scipy.signal.find_peaks()
将动作分割成重复。

我首先使用右眼关节作为参考来识别峰值。

import matplotlib.pyplot as plt
right_eye = excercise_action[:, 14, 1]
peaks, _ = find_peaks(-right_eye) #2D Skeletal is inverted
fig, ax = plt.subplots()
ax.plot(right_eye)
ax.plot(peaks, right_eye[peaks], 'x')
ax.set_title('Right Eye Movement Peaks "{}"'.format(excercise_label))
plt.show()

然后我根据峰值对动作进行切片

starting_frame = []
ending_frame = []

for ind in range(len(peaks)):
    #print(peaks[ind])
    if ind % 2 == 0:
        # get all starting frame
        starting_frame.append(peaks[ind])
    else:
        ending_frame.append(peaks[ind])

结果是这样的。

© www.soinside.com 2019 - 2024. All rights reserved.