Deep SORT Github does not give much information on how to use it e.g.
- what inputs it expects in what format
- which function in which code file handles the input
- What are the outputs
The github lists the code files.
In package deep_sort is the main tracking code:
- detection.py: Detection base class.
- kalman_filter.py: A Kalman filter implementation and concrete parametrization for image space filtering.
- linear_assignment.py: This module contains code for min cost matching and the matching cascade.
- iou_matching.py: This module contains the IOU matching metric.
- nn_matching.py: A module for a nearest neighbor matching metric.
- track.py: The track class contains single-target track data such as Kalman state, number of hits, misses, hit streak, associated feature vectors, etc.
- tracker.py: This is the multi-target tracker class. The deep_sort_app.py expects detections in a custom format, stored in .npy files. These can be computed from MOTChallenge detections using generate_detections.py. We also provide pre-generated detections.
By looking at tracker.py
, I guess update
method seems like the interface to feed the data about the detected objects. But what to do after?
def update(self, detections):
"""Perform measurement update and track management.
Parameters
----------
detections : List[deep_sort.detection.Detection]
A list of detections at the current time step.
"""
The detected object seems to be provided as the instance of Detection class in detection.py
. But not sure exactly what data to use.
class Detection(object):
"""
This class represents a bounding box detection in a single image.
Parameters
----------
tlwh : array_like
Bounding box in format `(x, y, w, h)`.
confidence : float
Detector confidence score.
feature : array_like
A feature vector that describes the object contained in this image.
Attributes
----------
tlwh : ndarray
Bounding box in format `(top left x, top left y, width, height)`.
confidence : ndarray
Detector confidence score.
feature : ndarray | NoneType
A feature vector that describes the object contained in this image.
"""
def __init__(self, tlwh, confidence, feature):
self.tlwh = np.asarray(tlwh, dtype=np.float)
self.confidence = float(confidence)
self.feature = np.asarray(feature, dtype=np.float32)
Question
Instead of reverse engineering the sample application, are there resources that explain the input, output, formats to use?
Research
There are multiple articles and githubs implementing object tracking with Yolo and DeepSort but it does not explain it either.