Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What motion model is used? #13

Open
r7vme opened this issue Sep 16, 2019 · 1 comment
Open

What motion model is used? #13

r7vme opened this issue Sep 16, 2019 · 1 comment

Comments

@r7vme
Copy link

r7vme commented Sep 16, 2019

Hello, thanks for nice repo. So far i believe motion model is incorrect.

For state matrix you use [[x], [y]], but state transition matrix is [[1, dt], [0, 1]], which is believe is for state matrix like [x, vx] (one dimentional constant velocity model). You're computing dot product between them here, which seems incorrect.

My suggestion would be to use two dimentional constant velocity model.

State matrix:

[[x],
 [y],
 [vx],
 [vy]]

Transition matrix:

[[1, 0, dt, 0],
 [0, 1, 0, dt],
 [0, 0, 1, 0],
 [0, 0, 0, 1]],
@BartvanMarrewijk
Copy link

Also some variables have to be updated, right?:
self.u = np.zeros((4, 1)) # previous state vector self.A = np.array([[1, 0,0,0], [0,1,0,0], [0, 0,0,0], [0, 0,0,0]]) self.b = np.array([[0], [0],[0],[0]]) self.P = np.diag((3.0, 3.0,0,0)) # covariance matrix

and in tracker.py from line 161:
` for i in range(len(assignment)):
self.tracks[i].KF.predict()

        if(assignment[i] != -1):
            self.tracks[i].skipped_frames = 0
            # self.tracks[i].prediction = self.tracks[i].KF.correct(
            #                             detections[assignment[i]], 1)
            self.tracks[i].prediction = self.tracks[i].KF.correct(
                                        np.array(([detections[assignment[i]][0][0]], [detections[assignment[i]][1][0]],[0],[0])), 1)
        else:
            # self.tracks[i].prediction = self.tracks[i].KF.correct(
            #                             np.array([[0], [0]]), 0)
            self.tracks[i].prediction = self.tracks[i].KF.correct(
                                        np.array([[0], [0],[0],[0]]), 0)

        if(len(self.tracks[i].trace) > self.max_trace_length):
            for j in range(len(self.tracks[i].trace) -
                           self.max_trace_length):
                del self.tracks[i].trace[j]

        # self.tracks[i].trace.append(self.tracks[i].prediction)
        self.tracks[i].trace.append(np.array(([self.tracks[i].prediction[0][0]],[self.tracks[i].prediction[1][0]])))
        self.tracks[i].KF.lastResult = self.tracks[i].prediction`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants