Tracker
- class motrackers.tracker.Tracker(max_lost=5, tracker_output_format='mot_challenge')[source]
Greedy Tracker with tracking based on
centroid
location of the bounding box of the object. This tracker is also referred asCentroidTracker
in this repository.- Parameters
max_lost (int) – Maximum number of consecutive frames object was not detected.
tracker_output_format (str) – Output format of the tracker.
- static preprocess_input(bboxes, class_ids, detection_scores)[source]
Preprocess the input data.
- Parameters
bboxes (list or numpy.ndarray) – Array of bounding boxes with each bbox as a tuple containing (xmin, ymin, width, height).
class_ids (list or numpy.ndarray) – Array of Class ID or label ID.
detection_scores (list or numpy.ndarray) – Array of detection scores (a.k.a. detection probabilities).
- Returns
Data for detections as list of tuples containing (bbox, class_id, detection_score).
- Return type
detections (list[Tuple])
- update(bboxes, detection_scores, class_ids)[source]
Update the tracker based on the new bounding boxes.
- Parameters
bboxes (numpy.ndarray or list) – List of bounding boxes detected in the current frame. Each element of the list represent coordinates of bounding box as tuple (top-left-x, top-left-y, width, height).
detection_scores (numpy.ndarray or list) – List of detection scores (probability) of each detected object.
class_ids (numpy.ndarray or list) – List of class_ids (int) corresponding to labels of the detected object. Default is None.
- Returns
List of tracks being currently tracked by the tracker. Each track is represented by the tuple with elements (frame_id, track_id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z).
- Return type
list
SORT
- motrackers.sort_tracker.assign_tracks2detection_iou(bbox_tracks, bbox_detections, iou_threshold=0.3)[source]
Assigns detected bounding boxes to tracked bounding boxes using IoU as a distance metric.
- Parameters
bbox_tracks (numpy.ndarray) – Bounding boxes of shape (N, 4) where N is number of objects already being tracked.
bbox_detections (numpy.ndarray) – Bounding boxes of shape (M, 4) where M is number of objects that are newly detected.
iou_threshold (float) – IOU threashold.
- Returns
- Tuple contains the following elements in the given order:
matches (numpy.ndarray): Array of shape (n, 2) where n is number of pairs formed after matching tracks to detections. This is an array of tuples with each element as matched pair of indices`(track_index, detection_index)`.
unmatched_detections (numpy.ndarray): Array of shape (m,) where m is number of unmatched detections.
unmatched_tracks (numpy.ndarray): Array of shape (k,) where k is the number of unmatched tracks.
- Return type
tuple
- class motrackers.sort_tracker.SORT(max_lost=0, tracker_output_format='mot_challenge', iou_threshold=0.3, process_noise_scale=1.0, measurement_noise_scale=1.0, time_step=1)[source]
SORT - Multi object tracker.
- Parameters
max_lost (int) – Max. number of times a object is lost while tracking.
tracker_output_format (str) – Output format of the tracker.
iou_threshold (float) – Intersection over union minimum value.
process_noise_scale (float or numpy.ndarray) – Process noise covariance matrix of shape (3, 3) or covariance magnitude as scalar value.
measurement_noise_scale (float or numpy.ndarray) – Measurement noise covariance matrix of shape (1,) or covariance magnitude as scalar value.
time_step (int or float) – Time step for Kalman Filter.
- update(bboxes, detection_scores, class_ids)[source]
Update the tracker based on the new bounding boxes.
- Parameters
bboxes (numpy.ndarray or list) – List of bounding boxes detected in the current frame. Each element of the list represent coordinates of bounding box as tuple (top-left-x, top-left-y, width, height).
detection_scores (numpy.ndarray or list) – List of detection scores (probability) of each detected object.
class_ids (numpy.ndarray or list) – List of class_ids (int) corresponding to labels of the detected object. Default is None.
- Returns
List of tracks being currently tracked by the tracker. Each track is represented by the tuple with elements (frame_id, track_id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z).
- Return type
list
IOU Tracker
- class motrackers.iou_tracker.IOUTracker(max_lost=2, iou_threshold=0.5, min_detection_confidence=0.4, max_detection_confidence=0.7, tracker_output_format='mot_challenge')[source]
Intersection over Union Tracker.
References
Implementation of this algorithm is heavily based on https://github.com/bochinski/iou-tracker
- Parameters
max_lost (int) – Maximum number of consecutive frames object was not detected.
tracker_output_format (str) – Output format of the tracker.
min_detection_confidence (float) – Threshold for minimum detection confidence.
max_detection_confidence (float) – Threshold for max. detection confidence.
iou_threshold (float) – Intersection over union minimum value.
- update(bboxes, detection_scores, class_ids)[source]
Update the tracker based on the new bounding boxes.
- Parameters
bboxes (numpy.ndarray or list) – List of bounding boxes detected in the current frame. Each element of the list represent coordinates of bounding box as tuple (top-left-x, top-left-y, width, height).
detection_scores (numpy.ndarray or list) – List of detection scores (probability) of each detected object.
class_ids (numpy.ndarray or list) – List of class_ids (int) corresponding to labels of the detected object. Default is None.
- Returns
List of tracks being currently tracked by the tracker. Each track is represented by the tuple with elements (frame_id, track_id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z).
- Return type
list
Kalman Filter based Centroid Tracker
- motrackers.centroid_kf_tracker.assign_tracks2detection_centroid_distances(bbox_tracks, bbox_detections, distance_threshold=10.0)[source]
Assigns detected bounding boxes to tracked bounding boxes using IoU as a distance metric.
- Parameters
bbox_tracks (numpy.ndarray) – Tracked bounding boxes with shape (n, 4) and each row as (xmin, ymin, width, height).
bbox_detections (numpy.ndarray) – detection bounding boxes with shape (m, 4) and each row as (xmin, ymin, width, height).
distance_threshold (float) – Minimum distance between the tracked object and new detection to consider for assignment.
- Returns
- Tuple containing the following elements:
matches (numpy.ndarray): Array of shape (n, 2) where n is number of pairs formed after matching tracks to detections. This is an array of tuples with each element as matched pair of indices`(track_index, detection_index)`.
unmatched_detections (numpy.ndarray): Array of shape (m,) where m is number of unmatched detections.
unmatched_tracks (numpy.ndarray): Array of shape (k,) where k is the number of unmatched tracks.
- Return type
tuple
- class motrackers.centroid_kf_tracker.CentroidKF_Tracker(max_lost=1, centroid_distance_threshold=30.0, tracker_output_format='mot_challenge', process_noise_scale=1.0, measurement_noise_scale=1.0, time_step=1)[source]
Kalman filter based tracking of multiple detected objects.
- Parameters
max_lost (int) – Maximum number of consecutive frames object was not detected.
tracker_output_format (str) – Output format of the tracker.
process_noise_scale (float or numpy.ndarray) – Process noise covariance matrix of shape (3, 3) or covariance magnitude as scalar value.
measurement_noise_scale (float or numpy.ndarray) – Measurement noise covariance matrix of shape (1,) or covariance magnitude as scalar value.
time_step (int or float) – Time step for Kalman Filter.
- update(bboxes, detection_scores, class_ids)[source]
Update the tracker based on the new bounding boxes.
- Parameters
bboxes (numpy.ndarray or list) – List of bounding boxes detected in the current frame. Each element of the list represent coordinates of bounding box as tuple (top-left-x, top-left-y, width, height).
detection_scores (numpy.ndarray or list) – List of detection scores (probability) of each detected object.
class_ids (numpy.ndarray or list) – List of class_ids (int) corresponding to labels of the detected object. Default is None.
- Returns
List of tracks being currently tracked by the tracker. Each track is represented by the tuple with elements (frame_id, track_id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z).
- Return type
list
Tracks
- class motrackers.track.Track(track_id, frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, data_output_format='mot_challenge', **kwargs)[source]
Track containing attributes to track various objects.
- Parameters
frame_id (int) – Camera frame id.
track_id (int) – Track Id
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (str or int) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
data_output_format (str) – Output format for data in tracker. Options include
['mot_challenge', 'visdrone_challenge']
. Default ismot_challenge
.kwargs (dict) – Additional key word arguments.
- property centroid
Return the centroid of the bounding box.
- Returns
Centroid (x, y) of bounding box.
- Return type
numpy.ndarray
- get_mot_challenge_format()[source]
Get the tracker data in MOT challenge format as a tuple of elements containing (frame, id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z)
References
Website : https://motchallenge.net/
- Returns
Tuple of 10 elements representing (frame, id, bb_left, bb_top, bb_width, bb_height, conf, x, y, z).
- Return type
tuple
- get_vis_drone_format()[source]
Track data output in VISDRONE Challenge format with tuple as (frame_index, target_id, bbox_left, bbox_top, bbox_width, bbox_height, score, object_category, truncation, occlusion).
References
Website : http://aiskyeye.com/
Paper : https://arxiv.org/abs/2001.06303
GitHub : https://github.com/VisDrone/VisDrone2018-MOT-toolkit
GitHub : https://github.com/VisDrone/
- Returns
Tuple containing the elements as (frame_index, target_id, bbox_left, bbox_top, bbox_width, bbox_height, score, object_category, truncation, occlusion).
- Return type
tuple
- update(frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, **kwargs)[source]
Update the track.
- Parameters
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (int or str) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
kwargs (dict) – Additional key word arguments.
- class motrackers.track.KFTrackSORT(track_id, frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, data_output_format='mot_challenge', process_noise_scale=1.0, measurement_noise_scale=1.0, **kwargs)[source]
Track based on Kalman filter tracker used for SORT MOT-Algorithm.
- Parameters
track_id (int) – Track Id
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (str or int) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
data_output_format (str) – Output format for data in tracker. Options
['mot_challenge', 'visdrone_challenge']
. Default ismot_challenge
.process_noise_scale (float) – Process noise covariance scale or covariance magnitude as scalar value.
measurement_noise_scale (float) – Measurement noise covariance scale or covariance magnitude as scalar value.
kwargs (dict) – Additional key word arguments.
- predict()[source]
Predicts the next estimate of the bounding box of the track.
- Returns
Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
- Return type
numpy.ndarray
- update(frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, **kwargs)[source]
Update the track.
- Parameters
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (int or str) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
kwargs (dict) – Additional key word arguments.
- class motrackers.track.KFTrack4DSORT(track_id, frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, data_output_format='mot_challenge', process_noise_scale=1.0, measurement_noise_scale=1.0, kf_time_step=1, **kwargs)[source]
Track based on Kalman filter tracker used for SORT MOT-Algorithm.
- Parameters
track_id (int) – Track Id
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (str or int) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
data_output_format (str) – Output format for data in tracker. Options
['mot_challenge', 'visdrone_challenge']
. Default ismot_challenge
.process_noise_scale (float) – Process noise covariance scale or covariance magnitude as scalar value.
measurement_noise_scale (float) – Measurement noise covariance scale or covariance magnitude as scalar value.
kwargs (dict) – Additional key word arguments.
- update(frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, **kwargs)[source]
Update the track.
- Parameters
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (int or str) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
kwargs (dict) – Additional key word arguments.
- class motrackers.track.KFTrackCentroid(track_id, frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, data_output_format='mot_challenge', process_noise_scale=1.0, measurement_noise_scale=1.0, **kwargs)[source]
Track based on Kalman filter used for Centroid Tracking of bounding box in MOT.
- Parameters
track_id (int) – Track Id
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (str or int) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
data_output_format (str) – Output format for data in tracker. Options
['mot_challenge', 'visdrone_challenge']
. Default ismot_challenge
.process_noise_scale (float) – Process noise covariance scale or covariance magnitude as scalar value.
measurement_noise_scale (float) – Measurement noise covariance scale or covariance magnitude as scalar value.
kwargs (dict) – Additional key word arguments.
- predict()[source]
Predicts the next estimate of the bounding box of the track.
- Returns
Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
- Return type
numpy.ndarray
- update(frame_id, bbox, detection_confidence, class_id=None, lost=0, iou_score=0.0, **kwargs)[source]
Update the track.
- Parameters
frame_id (int) – Camera frame id.
bbox (numpy.ndarray) – Bounding box pixel coordinates as (xmin, ymin, width, height) of the track.
detection_confidence (float) – Detection confidence of the object (probability).
class_id (int or str) – Class label id.
lost (int) – Number of times the object or track was not tracked by tracker in consecutive frames.
iou_score (float) – Intersection over union score.
kwargs (dict) – Additional key word arguments.
Kalman Filters
- class motrackers.kalman_tracker.KalmanFilter(transition_matrix, measurement_matrix, control_matrix=None, process_noise_covariance=None, measurement_noise_covariance=None, prediction_covariance=None, initial_state=None)[source]
Kalman Filter Implementation.
- Parameters
transition_matrix (numpy.ndarray) – Transition matrix of shape
(n, n)
.measurement_matrix (numpy.ndarray) – Measurement matrix of shape
(m, n)
.control_matrix (numpy.ndarray) – Control matrix of shape
(m, n)
.process_noise_covariance (numpy.ndarray) – Covariance matrix of shape
(n, n)
.measurement_noise_covariance (numpy.ndarray) – Covariance matrix of shape
(m, m)
.prediction_covariance (numpy.ndarray) – Predicted (a priori) estimate covariance of shape
(n, n)
.initial_state (numpy.ndarray) – Initial state of shape
(n,)
.
- class motrackers.kalman_tracker.KFTrackerConstantAcceleration(initial_measurement, time_step=1, process_noise_scale=1.0, measurement_noise_scale=1.0)[source]
Kalman Filter with constant acceleration kinematic model.
- Parameters
initial_measurement (numpy.ndarray) – Initial state of the tracker.
time_step (float) – Time step.
process_noise_scale (float) – Process noise covariance scale. or covariance magnitude as scalar value.
measurement_noise_scale (float) – Measurement noise covariance scale. or covariance magnitude as scalar value.
- class motrackers.kalman_tracker.KFTracker1D(initial_measurement=array([0.0]), time_step=1, process_noise_scale=1.0, measurement_noise_scale=1.0)[source]
- class motrackers.kalman_tracker.KFTracker2D(initial_measurement=array([0.0, 0.0]), time_step=1, process_noise_scale=1.0, measurement_noise_scale=1.0)[source]
- class motrackers.kalman_tracker.KFTracker4D(initial_measurement=array([0.0, 0.0, 0.0, 0.0]), time_step=1, process_noise_scale=1.0, measurement_noise_scale=1.0)[source]
- class motrackers.kalman_tracker.KFTrackerSORT(bbox, process_noise_scale=1.0, measurement_noise_scale=1.0, time_step=1)[source]
Kalman filter for
SORT
.- Parameters
bbox (numpy.ndarray) – Bounding box coordinates as
(xmid, ymid, area, aspect_ratio)
.time_step (float or int) – Time step.
process_noise_scale (float) – Scale (a.k.a covariance) of the process noise.
measurement_noise_scale (float) – Scale (a.k.a. covariance) of the measurement noise.
Object Detection
- class motrackers.detectors.detector.Detector(object_names, confidence_threshold, nms_threshold, draw_bboxes=True)[source]
Abstract class for detector.
- Parameters
object_names (dict) – Dictionary containing (key, value) as (class_id, class_name) for object detector.
confidence_threshold (float) – Confidence threshold for object detection.
nms_threshold (float) – Threshold for non-maximal suppression.
draw_bboxes (bool) – If true, draw bounding boxes on the image is possible.
- detect(image)[source]
Detect objects in the input image.
- Parameters
image (numpy.ndarray) – Input image.
- Returns
- Tuple containing the following elements:
bboxes (numpy.ndarray): Bounding boxes with shape (n, 4) containing detected objects with each row as (xmin, ymin, width, height).
confidences (numpy.ndarray): Confidence or detection probabilities if the detected objects with shape (n,).
class_ids (numpy.ndarray): Class_ids or label_ids of detected objects with shape (n, 4)
- Return type
tuple
- draw_bboxes(image, bboxes, confidences, class_ids)[source]
Draw the bounding boxes about detected objects in the image.
- Parameters
image (numpy.ndarray) – Image or video frame.
bboxes (numpy.ndarray) – Bounding boxes pixel coordinates as (xmin, ymin, width, height)
confidences (numpy.ndarray) – Detection confidence or detection probability.
class_ids (numpy.ndarray) – Array containing class ids (aka label ids) of each detected object.
- Returns
image with the bounding boxes drawn on it.
- Return type
numpy.ndarray
- class motrackers.detectors.caffe.Caffe_SSDMobileNet(weights_path, configfile_path, labels_path, confidence_threshold=0.5, nms_threshold=0.2, draw_bboxes=True, use_gpu=False)[source]
Caffe SSD MobileNet model for Object Detection.
- Parameters
weights_path (str) – path to network weights file.
configfile_path (str) – path to network configuration file.
labels_path (str) – path to data labels json file.
confidence_threshold (float) – confidence threshold to select the detected object.
nms_threshold (float) – Non-maximum suppression threshold.
draw_bboxes (bool) – If True, assign colors for drawing bounding boxes on the image.
use_gpu (bool) – If True, try to load the model on GPU.
- class motrackers.detectors.tf.TF_SSDMobileNetV2(weights_path, configfile_path, labels_path, confidence_threshold=0.5, nms_threshold=0.4, draw_bboxes=True, use_gpu=False)[source]
Tensorflow SSD MobileNetv2 model for Object Detection.
- Parameters
weights_path (str) – path to network weights file.
configfile_path (str) – path to network configuration file.
labels_path (str) – path to data labels json file.
confidence_threshold (float) – confidence threshold to select the detected object.
nms_threshold (float) – Non-maximum suppression threshold.
draw_bboxes (bool) – If True, assign colors for drawing bounding boxes on the image.
use_gpu (bool) – If True, try to load the model on GPU.
- class motrackers.detectors.yolo.YOLOv3(weights_path, configfile_path, labels_path, confidence_threshold=0.5, nms_threshold=0.2, draw_bboxes=True, use_gpu=False)[source]
YOLOv3 Object Detector Module.
- Parameters
weights_path (str) – path to network weights file.
configfile_path (str) – path to network configuration file.
labels_path (str) – path to data labels json file.
confidence_threshold (float) – confidence threshold to select the detected object.
nms_threshold (float) – Non-maximum suppression threshold.
draw_bboxes (bool) – If True, assign colors for drawing bounding boxes on the image.
use_gpu (bool) – If True, try to load the model on GPU.
- detect(image)[source]
Detect objects in the input image.
- Parameters
image (numpy.ndarray) – Input image.
- Returns
- Tuple containing the following elements:
bboxes (numpy.ndarray): Bounding boxes with shape (n, 4) containing detected objects with each row as (xmin, ymin, width, height).
confidences (numpy.ndarray): Confidence or detection probabilities if the detected objects with shape (n,).
class_ids (numpy.ndarray): Class_ids or label_ids of detected objects with shape (n, 4)
- Return type
tuple
Utilities
- motrackers.utils.misc.get_centroid(bboxes)[source]
Calculate centroids for multiple bounding boxes.
- Parameters
bboxes (numpy.ndarray) – Array of shape (n, 4) or of shape (4,) where each row contains (xmin, ymin, width, height).
- Returns
Centroid (x, y) coordinates of shape (n, 2) or (2,).
- Return type
numpy.ndarray
- motrackers.utils.misc.iou(bbox1, bbox2)[source]
Calculates the intersection-over-union of two bounding boxes. Source: https://github.com/bochinski/iou-tracker/blob/master/util.py
- Parameters
bbox1 (numpy.array or list[floats]) – Bounding box of length 4 containing
(x-top-left, y-top-left, x-bottom-right, y-bottom-right)
.bbox2 (numpy.array or list[floats]) – Bounding box of length 4 containing
(x-top-left, y-top-left, x-bottom-right, y-bottom-right)
.
- Returns
intersection-over-onion of bbox1, bbox2.
- Return type
float
- motrackers.utils.misc.iou_xywh(bbox1, bbox2)[source]
Calculates the intersection-over-union of two bounding boxes. Source: https://github.com/bochinski/iou-tracker/blob/master/util.py
- Parameters
bbox1 (numpy.array or list[floats]) – bounding box of length 4 containing
(x-top-left, y-top-left, width, height)
.bbox2 (numpy.array or list[floats]) – bounding box of length 4 containing
(x-top-left, y-top-left, width, height)
.
- Returns
intersection-over-onion of bbox1, bbox2.
- Return type
float
- motrackers.utils.misc.xyxy2xywh(xyxy)[source]
Convert bounding box coordinates from (xmin, ymin, xmax, ymax) format to (xmin, ymin, width, height).
- Parameters
xyxy (numpy.ndarray) –
- Returns
Bounding box coordinates (xmin, ymin, width, height).
- Return type
numpy.ndarray
- motrackers.utils.misc.xywh2xyxy(xywh)[source]
Convert bounding box coordinates from (xmin, ymin, width, height) to (xmin, ymin, xmax, ymax) format.
- Parameters
xywh (numpy.ndarray) – Bounding box coordinates as (xmin, ymin, width, height).
- Returns
Bounding box coordinates as (xmin, ymin, xmax, ymax).
- Return type
numpy.ndarray
- motrackers.utils.misc.midwh2xywh(midwh)[source]
Convert bounding box coordinates from (xmid, ymid, width, height) to (xmin, ymin, width, height) format.
- Parameters
midwh (numpy.ndarray) – Bounding box coordinates (xmid, ymid, width, height).
- Returns
Bounding box coordinates (xmin, ymin, width, height).
- Return type
numpy.ndarray
- motrackers.utils.misc.intersection_complement_indices(big_set_indices, small_set_indices)[source]
Get the complement of intersection of two sets of indices.
- Parameters
big_set_indices (numpy.ndarray) – Indices of big set.
small_set_indices (numpy.ndarray) – Indices of small set.
- Returns
Indices of set which is complementary to intersection of two input sets.
- Return type
numpy.ndarray
- motrackers.utils.misc.nms(boxes, scores, overlapThresh, classes=None)[source]
Non-maximum suppression. based on Malisiewicz et al.
- Parameters
boxes (numpy.ndarray) – Boxes to process (xmin, ymin, xmax, ymax)
scores (numpy.ndarray) – Corresponding scores for each box
overlapThresh (float) – Overlap threshold for boxes to merge
classes (numpy.ndarray, optional) – Class ids for each box.
- Returns
- a tuple containing:
boxes (list): nms boxes
scores (list): nms scores
classes (list, optional): nms classes if specified
- Return type
tuple
- motrackers.utils.misc.draw_tracks(image, tracks)[source]
Draw on input image.
- Parameters
image (numpy.ndarray) – image
tracks (list) – list of tracks to be drawn on the image.
- Returns
image with the track-ids drawn on it.
- Return type
numpy.ndarray
- motrackers.utils.filechooser_utils.create_filechooser(default_path='~/', html_title='Select File', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_caffemodel_prototxt(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_caffemodel_weights(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_caffemodel(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_yolo_weights(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_coco_labels(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_yolo_config(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_yolo_model(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_tfmobilenet_weights(default_path='~/', use_dir_icons=True)[source]
- motrackers.utils.filechooser_utils.select_tfmobilenet(default_path='~/', use_dir_icons=True)[source]
Download pretrained neural-network weights.
YOLOv3
cd multi-object-tracker
cd ./examples/pretrained_models/yolo_weights
sudo chmod +x ./get_yolo.sh
./get_yolo.sh
TensorFlow - MobileNetSSDv2
cd multi-object-tracker
cd ./pretrained_models/tensorflow_weights
sudo chmod +x ./get_ssd_model.sh
./get_ssd_model.sh
Caffemodel - MobileNetSSD
cd multi-object-tracker
cd ./pretrained_models/caffemodel_weights
sudo chmod +x ./get_caffemodel.sh
./get_caffemodel.sh
References and Credits
This work is based on the following literature:
Bochinski, E., Eiselein, V., & Sikora, T. (2017, August). High-speed tracking-by-detection without using image information. In 2017 14th IEEE International Conference on Advanced Video and Signal Based Surveillance (AVSS) (pp. 1-6). IEEE. [pdf]
Bewley, A., Ge, Z., Ott, L., Ramos, F., & Upcroft, B. (2016, September). Simple online and realtime tracking. In 2016 IEEE International Conference on Image Processing (ICIP) (pp. 3464-3468). IEEE. [arxiv]
Kalman Filter. [wiki]
TensorFlow Object Detection API [GitHub]
Contributor Covenant Code of Conduct
Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards
Examples of behavior that contributes to creating a positive environment include:
Using welcoming and inclusive language
Being respectful of differing viewpoints and experiences
Gracefully accepting constructive criticism
Focusing on what is best for the community
Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
The use of sexualized language or imagery and unwelcome sexual attention or advances
Trolling, insulting/derogatory comments, and personal or political attacks
Public or private harassment
Publishing others’ private information, such as a physical or electronic address, without explicit permission
Other conduct which could reasonably be considered inappropriate in a professional setting
Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at adityadeshpande2010@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
Attribution
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq