Using exponential smoothing with NaN values
I have a sample that can generate some noisy output. The sample is the result of some processing on the camera image that indicates the title of a blob of a particular color. This is an angle of about -45 degrees Celsius; to + 45 °, or NaN
which means the blob is not actually displayed.
To combat noisy data, I felt that exponential smoothing would do the trick. However, I'm not sure how to handle the values NaN
.
On the one hand, involving them in the math will lead to the mean NaN
, which will then prevent any meaningful results. On the other hand, ignoring the values NaN
entirely means that the "no-detect" scenario will never be reported. And just to complicate matters, the data is also noisy in that it can get false NaN
, which would ideally be flattened in some way to prevent accidental noise.
Any ideas on how I could implement such exponential smoothness?
a source to share
How do I keep the two distributions? The first could be your antialiased blob header as usual, except when you get NaN, instead just type in what was the last value seen other than NaN (or some other default); the other is the "NaN distribution", which just gets 0 for every value other than NaN and 1 for every NaN (or something like that).
This way, even if closed, your main distribution will continue to predict based on the "last known header" without getting garbage data or messing up the anti-aliasing, but you will also get a simultaneous spike in the NaN distribution letting you know something.
a source to share
Well it really depends on what you are doing with the smoothed data. One thing you can try is to have an exponentially weighted smoothing of the speed of the blob in addition to its location where the NaNs contribute zero. When you encounter NaN, you can replace it with the projected position based on the previous position and smoothed speed. By smoothing out the speed, you can prevent an entire sequence of NaNs from generating completely crazy large or small values. This can cause the values to be equal to [-45.45], which should take into account that it is out of sight and the side to which he left the view. Now you will need to make sure that this gives good results in the computer vision algorithm. If not,you can also try replacing NaN with the previous value or zero, or simply ignore NaN and see which works best.
a source to share