kcg2015 / Vehicle-Detection-and-Tracking

Computer vision based vehicle detection and tracking using Tensorflow Object Detection API and Kalman-filtering
533 stars 191 forks source link

When no detections are present : #5

Closed Aayushktyagi closed 5 years ago

Aayushktyagi commented 5 years ago

I am curious to know that will kalman tracker work when no object is detected in the frame.I saw few ropo(https://github.com/abewley/sort) required detection in every frame otherwise it will leave track on object(car in this case). So will kalman predict function will give next location even when no detection is received from detector.

Thanks in advance.

kcg2015 commented 5 years ago

@Aayushktyagi , Kalman filter can predict the location of the bounding box even when detector fails to provide a bounding box. If you take a close look at predict_only function in tracker.py

def predict_only(self):
''' Implment only the predict stage. This is used for unmatched detections and unmatched tracks ''' x = self.x_state

Predict

    x = dot(self.F, x)
    self.P = dot(self.F, self.P).dot(self.F.T) + self.Q
    self.x_state = x.astype(int)

x= dot(self.F.x) predicts the next location, based on the state x, obtained from previous prediction and update cycles. Here we use a very simple constant velocity model (see self.F), so current_location + velocity * time = next_location.

One thing to note, if the detector keeps on failing to provide bounding boxes in a sequence of frames, the prediction alone will become less and less accurate. In other words, Kalman filter can only address a noisy or the absence of detection for a short duration of time.

Let me know if you need further clairfication.

Aayushktyagi commented 5 years ago

Thank you so much for explanation.