Unofficial implementation of SORT, A simple online and realtime tracking algorithm for 2D multiple object tracking in video sequences.
SORT is based on the idea of a discrete Kalman Filter,representing each object to be tracked.
Kalman Filter estimates the state vector X of a discrete-time controlled process that is governed by the linear stochastic difference equation.
- Numpy
- scipy.optimize.linear_sum_assignment
- removeTrackAfternFramesThres - Number of frames to try to match a missed object before you delete it
- uncertaintyCount - Number of frames to consider an object as a confirmed tracker (an object can be Confirmed ("C"), UnCertain ("U), Missed ("M"))
$ git clone https://github.com/marwankefah/Kalman-Tracking-Single-Camera
from Kalman_Tracking_Single_Camera.src import tracking
from Kalman_Tracking_Single_Camera.src import helpers as hp
tracker=tracking.KalmanTracking(IOUThreshold=0.3 ,removeTrackAfternFramesThres=40,uncertaintyCount=1)
LOOP
GET DETECTION FROM YOUR DETECTION MODEL [[xminNew, yminNew, xmaxNew, ymaxNew],....]
## Return trackers in the form [[id,[xminNew, yminNew, xmaxNew, ymaxNew]],...] that matches the confirmed state
trackers=tracker.match(detections,state="C")
END LOOP
-
- X (state of persons in the system)
- z (measurements taken from Object Detection Model)
- A (Matrix that maps previous state to current State)
- B (Matrix that maps actions to states)
- U (Actions Taken)
- C (Matrix that maps mesurement to state)
- R (Process Noise, noise comming from the motion model)
- Q (Measurement Noise, noise comming from the object detection model)
Q and R covariance matrices are assumed to be independent and normally distributed. Q is chosen to be small as it correlate with how well your Object Detection Model Performs. R was assumed and adopted from the official Repository of SORT. However, someone can try to estimate such matrix from this paper.
-
- X (bounding box center position along the x axis)
- Y (bounding box center position along the y axis)
- A (Aspect Ratio of the bounding box calculaed by Width/Height)
- H (Height of the bounding box)
- Vx, Vy, Va,Vh are the rate of change of the above variables (velocity) respectively.