From 284f59a8d044c9c835f08f8aa3d0c39e1de5b579 Mon Sep 17 00:00:00 2001 From: Nicolai Wojke <nwojke@uni-koblenz.de> Date: Tue, 21 Mar 2017 21:07:49 +0100 Subject: [PATCH] Python 2 compability (thanks to Balint Fabry) --- README.md | 14 +++++++------- application_util/image_viewer.py | 2 +- application_util/visualization.py | 11 ++++++----- deep_sort_app.py | 5 +++-- generate_videos.py | 2 -- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 4f7df66..4e19435 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,19 @@ ## Introduction This repository contains code for *Simple Online and Realtime Tracking with a Deep Association Metric* (Deep SORT). +We extend the original [SORT](https://github.com/abewley/sort) algorithm to +integrate appearance information based on a deep appearance descriptor. ## Dependencies -Tracking code: +The code is compatible with Python 2.7 and 3. The following dependencies are +need to run the tracker: * NumPy -* sklean (for linear assignment) -* OpenCV (for visualization) +* sklean +* OpenCV -Additionally, feature generation requires: - -* TensorFlow -* tfslim +Additionally, feature generation requires TensorFlow (>= 1.0). ## Installation diff --git a/application_util/image_viewer.py b/application_util/image_viewer.py index b4f12e1..c9edd25 100644 --- a/application_util/image_viewer.py +++ b/application_util/image_viewer.py @@ -58,7 +58,7 @@ def view_roi(mat, roi): return mat[sy:ey, sx:ex, :] -class ImageViewer: +class ImageViewer(object): """An image viewer with drawing routines and video capture capabilities. Key Bindings: diff --git a/application_util/visualization.py b/application_util/visualization.py index 47b1233..f61e9b8 100644 --- a/application_util/visualization.py +++ b/application_util/visualization.py @@ -53,9 +53,10 @@ def create_unique_color_uchar(tag, hue_step=0.41): return int(255*r), int(255*g), int(255*b) -class NoVisualization: +class NoVisualization(object): """ - TODO(nwojke): Add documentation. + A dummy visualization object that loops through all frames in a given + sequence to update the tracker without performing any visualization. """ def __init__(self, seq_info): @@ -80,9 +81,9 @@ class NoVisualization: self.frame_idx += 1 -class Visualization: +class Visualization(object): """ - TODO(nwojke): Add documentation. + This class shows tracking output in an OpenCV image viewer. """ def __init__(self, seq_info, update_ms): @@ -130,4 +131,4 @@ class Visualization: *track.to_tlwh().astype(np.int), label=str(track.track_id)) # self.viewer.gaussian(track.mean[:2], track.covariance[:2, :2], # label="%d" % track.track_id) -# \ No newline at end of file +# diff --git a/deep_sort_app.py b/deep_sort_app.py index c946fb5..95854da 100644 --- a/deep_sort_app.py +++ b/deep_sort_app.py @@ -31,7 +31,8 @@ def gather_sequence_info(sequence_dir, detection_file): A dictionary of the following sequence information: * sequence_name: Name of the sequence - * image_filanemes: A dictionary that maps frame indices to image filenames. + * image_filenames: A dictionary that maps frame indices to image + filenames. * detections: A numpy array of detections in MOTChallenge format. * groundtruth: A numpy array of ground truth in MOTChallenge format. * image_size: Image size (height, width). @@ -163,7 +164,7 @@ def run(sequence_dir, detection_file, output_file, min_confidence, results = [] def frame_callback(vis, frame_idx): - print("Frame idx", frame_idx) + print("Processing frame %05d" % frame_idx) # Load image and generate detections. detections = create_detections( diff --git a/generate_videos.py b/generate_videos.py index 74282a9..8908ff2 100644 --- a/generate_videos.py +++ b/generate_videos.py @@ -57,8 +57,6 @@ if __name__ == "__main__": sys.exit() for sequence_txt in os.listdir(args.result_dir): sequence = os.path.splitext(sequence_txt)[0] - if sequence != "KITTI-13": - continue sequence_dir = os.path.join(args.mot_dir, sequence) if not os.path.exists(sequence_dir): continue -- GitLab