加速度计信号分割
我有一个一维加速度计信号(仅限一个轴)。我想创建一个强大的算法,它能够识别信号中的某些形状。
首先,我对原始信号应用移动平均滤波器。在附图中,原始信号为红色,平均信号为黑色。从图中可以看出,从平均(黑色)信号中可以看到一些趋势 - 该信号包含 10 次重复的峰状模式,其中加速度攀升至最大值,然后又下降。我用十字标记了这些模式的开始和结束。
所以我的目标是自动找到标记的位置。使模式提取变得困难的问题是:
- 模式的开头可能具有与模式结束不同的 y 值
- 模式可能有多个峰值
- 我没有任何具体的时间信息(从模式的开始到结束)模式需要时间单位)
我尝试了不同的方法,这些方法几乎都是自制的,所以我不会提及它们 - 我不希望你因我的思维方式而产生偏见。是否有一些标准或书本方法来进行这种模式提取?或者也许有人知道如何以稳健的方式解决这个问题?
任何想法将不胜感激。
I have a 1D accelerometer signal (one axis only). I would like to create a robust algorithm, which would be able to recognize some shapes in the signal.
At first I apply a moving average filter to the raw signal. On the attached picture the raw signal is coloured red and the averaged signal is black. As seen from the picture, some trends are visible from the averaged (black) signal - the signal contains 10 repetitions of a peak like pattern, where acceleration climbs to a maximum and then drops back down. I have marked the beginnings and endings of those patterns with a cross.
So my goal is to find the marked positions automatically. The problem making the pattern extraction difficult are:
- the start of the pattern could have a different y value than the end of the pattern
- the pattern could have more than one peak
- I do not have any concrete time information (from start to the end of the pattern it takes A time units)
I have tried different approaches, which are pretty much home-brew, so I won't mention them - I don't want you to be biased by my way of thinking. Are there some standard or by the books approaches for doing that kind of pattern extraction? Or maybe does anyone know how to tackle the problem in a robust way?
Any idea will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
保持简单!
看来移动平均线是一个足够好的阻尼装置;保持原样,如果您注意到它分别留下太多噪声或去除太多信号,则可能只增加或减少其样本计数。然后,您专门处理该平均信号。
您寻找的模式标记似乎相对容易检测。用英语表达,这些标记是:
目标=平均读数曲线中的拐点,此时斜率显着从负值变为正值。
因此,当每个新的读数值可用时,您应该能够通过比较与移动平均值一起计算的斜率值来检测这种情况(当然会有短暂的延迟,因为斜率当然会增加)仅当下一个[几个]点的平均读数可用时才能计算给定点的平均读数)
但是,为了避免错误检测,您需要定义一些旨在过滤不良模式的参数。这些参数将更精确地定义上述目标定义中“显着”的含义。
检测兴趣点的公式暂时可以像这样简单
(-1 * S(t-1) + St ) >最小增量斜率
哪里
S 分别是时间 t-1 和 t 时的斜率(更多内容)
Min_delta_Slope 是一个参数,定义我们希望的斜率变化的“急剧”程度。
假设标准化 t 和 Y 单位,我们可以将 Min_delta_Slope 参数设置为接近甚至超过 1。直观上,值 1(同样采用标准化单位)将表明我们的目标点是曲线“到达”的向下坡度为 50 的点% 并以 50% 的向上坡度离开该点(或 40% + 60% 或 .. 10% 即几乎平坦,90% 即几乎垂直)。
为了避免在曲线上仅出现小幅下降的情况下检测点,我们可以考虑更多点,使用更高级的公式,例如
(Pm2 * S(t-2) + Pm1 * S(t-1) + P0 * St + Pp1 S (t+1) ) >最小增量斜率
哪里
Pm2、Pm1、P0 和 Pp1 是赋予关注点前后各个点的坡度相对重要性的系数。 (Pm2 和 Pm1 通常为负值,除非我们仅使用正参数并在公式中使用负号)
St +/- n 是不同时间的斜率
Min_delta_Slope 是一个参数,定义了我们希望的斜率变化的最小程度。
直观上,这个 4 点公式将考虑在感兴趣点之前的两个读数和过去的两个读数处的曲线形状(此外还考虑该点之前和之后的点)。给定参数的正确值,该公式将要求曲线在两个时间片内稳定“下降”,然后在接下来的两个时间片内稳定上升,从而避免在曲线中标记较小的下降。
实现此目的的另一种方法可能是使用两个(或更多)时间片之前的[平均]读数与当前[平均]读数之间的 Y 值差异来计算斜率阅读。这两种方法相似,但会产生略有不同的结果;一般来说,我们对 Pm2、Pm1、P0 和 P1 参数的曲线所需形状有更多的发言权。
Keep it simple!
It appears the moving average is a good enough damper device; keep it as-is, maybe only increasing or decreasing its sample count if you notice that it either leaves too much noise or removes too much signal respectively. You then work off the this averaged signal exclusively.
The pattern markers you seek seems relatively easy to detect. Expressed in English, these markers are:
Targets = the points of inflection in the averaged readings curve, when the slope goes markedly negative to positive.
You should therefore be able to detect this situation by comparison of the slope values, calculated along with the moving average, as each new reading value comes available (of course with a short delay, as of course the slope at a given point can only be calculated when the averaged reading for the next [few] point[s] is available)
To avoid false detection, however, you'd need to define a few parameters aimed at filtering the undesirable patterns. These paremeters will define more precisely the meaning of "markedly" in the above target definition.
Tentatively the formula for detecting a point of interest could be as simple as this
(-1 * S(t-1) + St ) > Min_delta_Slope
where
S is the slope (more on this) at time t-1 and t, respectively
Min_delta_Slope is a parameter defining how "sharp" a change in slope we want at a minimum.
Assuming normalized t and Y units, we can set the Min_delta_Slope parameter close to or even past 1. Intuitively a value of 1 (again in normalized units) would indicate that we target points where the curved "arrived" with a downward slope of say 50% and left the point with a upward slope of 50% (or 40% + 60% or .. 10% i.e almost flat and 90% i.e. almost vertical).
To avoid detecting points in the case when this is merely a small dip in the curve, we can take more points into consideration, with a fancier formula such as say
(Pm2 * S(t-2) + Pm1 * S(t-1) + P0 * St + Pp1 S(t+1) ) > Min_delta_Slope
where
Pm2, Pm1, P0 and Pp1 are coefficients giving relative importance to the slope at various point before and after the point of interest. (Pm2 and Pm1 typically negative values unless we use only positive parameter and use negative signs in the formula)
St +/- n is the slope a various times
and Min_delta_Slope is a parameter defining how "sharp" a change in slope we want at a minimum.
Intuitively, this 4 points formula would take into account the shape of the curve at a point two readings prior and two reading past the point of interest (in addition to considering the point right before and after it). Given the proper values for the parameters, the formula would require that the curve be steadily coming "down" for two time slices, then steadily going up for the next two time slices, hence avoiding to mark smaller dips in the curve.
An alternative way to achieve this, may be to compute the slope by using the difference in Y value between the [averaged] reading from two (or more) time slices ago and that of the current [averaged] reading. These two approaches are similar but would produce slightly different result; generally we'd have more say on the desired shape of the curve with the Pm2, Pm1, P0 and P1 parameters.
您可能想看看分水岭分割,它做了类似的事情(将景观划分为单独的流域)。奇怪的是,我实际上正在写一篇博士论文,目前大量使用分水岭(说真的:))
You might want to look at watershed segmentation, which does a related kind of thing (dividing landscapes into their separate catchment basins). Oddly enough, I'm actually writing a PhD thesis which uses watershed a lot at the moment (seriously :))