Closed chaotianjiao closed 3 years ago
Hi! You need to think more carefully what you are trying to model: what is the dimension of the measurement (res
): Is each measurement a 2D-vector (e.g., [237 149] would be one measurement), a 4D-vector ([[237], [162], [378], [260]] would be one measurement) or is it really a 4x2 matrix, in which case you cannot directly use a Kalman fitlter on it but have to first, e.g., flatten it into a vector of size 8. Depending on the answer, you need to modify the dimensions of the H matrix accordingly.
The fact that the value of the measurement is different on each "frame" does not require you to use "time-varying" parts of the Simdkalman library, unless the matrices A, H, R or Q also change on each frame.
Also take a moment to think about the hidden state, what is it's dimension and how is it related to the measurement. This other dimension of H and both dimensions of A (and the contents of the matrices A & H). If you simply set them to identity matrices (multiplied by some factor), it is proably not the optimal way to model the situation.
@oseiskar Hi ,Thanks for your reply ! the measurement(res) is a 4x2 matrix.Actually they are four points of a frame. We init it as res = np.array( [[237, 149], [162 ,223], [378 ,227], [260 , 149]]).It it the first frame's output. res[0] is the first point,res[0][0] is the first point's x-axis. It is really a 4x2 matrix. On each frame the four points are different, we want use kalman filter to track these points. A,H,R and Q are const, they will not change on each frame. So I use simdkalman.Kalmanfilter can solve my problem? And I want to know is there any good way to get best values of A and H ?
I will be very appreciated if you can answer my questions above. Thanks~
Hi, I'm new to kalman, can you help me? This is my code:
But I always get the assert error:
Traceback (most recent call last): File "D:/PycharmProjects/first_ldw/test.py", line 64, in
m,P= update(m, P, H, R, np.eye(4)0.01)
File "D:\Python38\lib\site-packages\simdkalman\primitives.py", line 146, in update
return _update(prior_mean, prior_covariance, observation_model, observation_noise, measurement)[:2]
File "D:\Python38\lib\site-packages\simdkalman\primitives.py", line 52, in reshaped_func
outputs = func([to_3d_array(a) for a in args], **kwargs)
File "D:\Python38\lib\site-packages\simdkalman\primitives.py", line 95, in _update
assert(measurement.shape[-2:] == (m,1))
AssertionError
Where should I modify my code ?
Thanks~