discopat.tracking

SORT: A Simple, Online and Realtime Tracker.

Copyright (C) 2016-2020 Alex Bewley alex@bewley.ai

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Functions

associate_detections_to_trackers(detections, ...)

Assign detections to tracked object (both represented as bounding boxes).

convert_bbox_to_z(bbox)

Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form

convert_x_to_bbox(x[, score])

Takes a bounding box in the centre form [x,y,s,r] and returns it in the form

iou_batch(bb_test, bb_gt)

From SORT: Computes IOU between two bboxes in the form [x1,y1,x2,y2].

linear_assignment(cost_matrix)

parse_args()

Parse input arguments.

Classes

KalmanBoxTracker(bbox)

This class represents the internal state of individual tracked objects observed as bbox.

Sort([max_age, min_hits, iou_threshold])

class discopat.tracking.KalmanBoxTracker(bbox)[source]

Bases: object

This class represents the internal state of individual tracked objects observed as bbox.

count = 0
get_state()[source]

Returns the current bounding box estimate.

predict()[source]

Advances the state vector and returns the predicted bounding box estimate.

update(bbox)[source]

Updates the state vector with observed bbox.

class discopat.tracking.Sort(max_age=1, min_hits=3, iou_threshold=0.3)[source]

Bases: object

update(dets=array([], shape=(0, 5), dtype=float64))[source]
Params:

dets - a numpy array of detections in the format [[x1,y1,x2,y2,score],[x1,y1,x2,y2,score],…]

Requires: this method must be called once for each frame even with empty detections (use np.empty((0, 5)) for frames without detections). Returns the a similar array, where the last column is the object ID.

NOTE: The number of objects returned may differ from the number of detections provided.

discopat.tracking.associate_detections_to_trackers(detections, trackers, iou_threshold=0.3)[source]

Assign detections to tracked object (both represented as bounding boxes).

Returns 3 lists of matches, unmatched_detections and unmatched_trackers

discopat.tracking.convert_bbox_to_z(bbox)[source]
Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form

[x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is the aspect ratio

discopat.tracking.convert_x_to_bbox(x, score=None)[source]
Takes a bounding box in the centre form [x,y,s,r] and returns it in the form

[x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right

discopat.tracking.iou_batch(bb_test, bb_gt)[source]

From SORT: Computes IOU between two bboxes in the form [x1,y1,x2,y2].

discopat.tracking.linear_assignment(cost_matrix)[source]
discopat.tracking.parse_args()[source]

Parse input arguments.