Forked from deep sort.
- Added support for scipy 0.23 and above. (See issue)
- Extended the deep sort model to include height (z-axis) and rotation (yaw) of the bounding box.
Note: The Kalman filter has not been modified to account for rotation and height. Instead, these parameters are stored in the track object as a moving average over the last 10 frames.
from deep_sort_3d.src.tracker import Tracker as DeepSort3D
from deep_sort_3d.src.detection import Detection
from deep_sort_3d.src.nn_matching import NearestNeighborDistanceMetric
tracker = DeepSort3D(
metric=NearestNeighborDistanceMetric("cosine", 0.2, 100),
max_age=30,
n_init=3
)
# your code here
detection_list = ... # list[bbox]. bbox = (objectness, (x, y), (w, h), angle, height)
deep_sort_detection_list = []
rotation_list = []
height_list = []
dummy_feature = np.array([1,0]) # dummy feature
for box in detection_list:
objectness, (x, y), (w, l), angle, height = box
deep_sort_detection = Detection((x,y,w,l), objectness, dummy_feature)
deep_sort_detection_list.append(deep_sort_detection)
rotation_list.append(angle)
height_list.append(height)
tracker.predict()
tracker.update(deep_sort_detection_list, rotation_list, height_list)
# Access the tracks
for track in tracker.tracks:
print(track.track_id)
print(track.to_tlwh())
print(track.get_angle())
print(track.get_height())