Why use the Neyman-Pearson lemma for zero-velocity detection?
I was reading a this papar about detecting when a foot-mounted inertial measurement unit (IMU) is stationary. I thought a few lines of code might be enough. Check how much the accelerometer and gyroscope readings vary, then check whether the median gyroscope reading on each axis is close to zero. Why did the authors need the Neyman–Pearson lemma?
for (int i = 0; i < 3; i++) {
if (std_acc[i] > imu_base_options_.zupt_max_acc_std) return;
if (std_gyro[i] > imu_base_options_.zupt_max_gyro_std) return;
if (fabs(median_gyro[i]) > imu_base_options_.zupt_max_gyro_median) return;
}
It’s easy to see what the code checks.
What happens when the detector is wrong?
Suppose the foot is halfway through a step and the detector declares it stationary. The navigation system applies a zero-velocity update (ZUPT), pulling its velocity estimate toward zero while the foot is still moving. That's a false alarm.
Now suppose the foot has stopped, but the detector still reports motion. That’s a missed detection. The system loses a chance to correct its velocity estimate. A false alarm has a different cost: it pulls the estimate toward zero while the foot is moving.
That gives us a precise question. If we set an upper limit on the probability of a false alarm, how many of the truly stationary intervals can we detect?
What does the Neyman-Pearson lemma buy us?
In the figure, the dashed line marks the cutoff, (). A window counts as stationary if its score falls to the right of the line. The green area on that side is the detection probability, (). The orange area is the false-alarm probability, (). Move the line to the left and both areas grow. We catch more stops, but we also mistake more movement for rest.
In this example, the orange area is 5%. Suppose that's the highest false-alarm rate we'll accept. Of all the rules that meet that limit, which one catches the most stops?
If we know how the readings are distributed during motion and at rest, the Neyman–Pearson lemma gives us an answer. For each window of readings, we divide its likelihood under the stationary model by its likelihood under the moving model. We label the window stationary if that ratio exceeds a cutoff. With the cutoff set for a 5% false-alarm rate, no rule with a false-alarm rate of 5% or less can detect a larger fraction of stationary windows on average.
Now look again at those three lines of code. Of the windows in which the foot is moving, what fraction pass all three checks? That fraction is the detector’s false-alarm rate, . The code sets limits on the sensor readings, but it gives us no guarantee that .