The Sort algorithm is a simple yet robust real-time tracking algorithm for the multiple-object tracking of detected objects in video sequences. The algorithm has a mechanism to associate detections and trackers that results in a maximum of one detection box for each tracked object.
For each tracked object, the algorithm creates an instance of a single object-tracking class. Based on physical principles such as an object cannot rapidly change size or speed, the class instance can predict the feature location of the object and maintain tracking from frame to frame. The latter is achieved with the help of the Kalman filter.
We import the modules that we will use in the implementation of the algorithm as follows:
import numpy as np
from scipy.optimize import linear_sum_assignment
from typing import Tuple
import cv2
As usual, the main dependencies are numpy...