pipert.contrib.sort_tracker.sort

SORT: A Simple, Online and Realtime Tracker Copyright (C) 2016 Alex Bewley alex@dynamicdetection.com 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/>.

Module Contents

Classes

KalmanBoxTracker

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

Sort

Functions

iou(bb_test, bb_gt)

Computes IUO between two bboxes in the form [x1,y1,x2,y2]

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=None)

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

associate_detections_to_trackers(detections, trackers, iou_threshold=0.3)

Assigns detections to tracked object (both represented as bounding boxes)

pipert.contrib.sort_tracker.sort.iou(bb_test, bb_gt)[source]

Computes IUO between two bboxes in the form [x1,y1,x2,y2]

pipert.contrib.sort_tracker.sort.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

pipert.contrib.sort_tracker.sort.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

class pipert.contrib.sort_tracker.sort.KalmanBoxTracker(bbox, window_size=None)[source]

Bases: object

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

count = 0[source]
update(self, bbox)[source]

Updates the state vector with observed bbox.

predict(self)[source]

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

get_state(self)[source]

Returns the current bounding box estimate.

pipert.contrib.sort_tracker.sort.associate_detections_to_trackers(detections, trackers, iou_threshold=0.3)[source]

Assigns detections to tracked object (both represented as bounding boxes) Returns 3 lists of matches, unmatched_detections and unmatched_trackers

class pipert.contrib.sort_tracker.sort.Sort(max_age: int = 1, min_hits: int = None, window_size: int = None, percent_seen: float = None, verbose: bool = False)[source]
reset(self)[source]

reset the tracker, the same functionality as initializing a new Sort object

update(self, dets: numpy.array)[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. 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.