From 8d71d7187e8dc6b2961ff18a782eb477e0d0e5aa Mon Sep 17 00:00:00 2001 From: fprott Date: Thu, 25 Jul 2024 15:32:40 +0200 Subject: [PATCH 1/2] Update core.py Turns out score in Detection can be None but format can't handle that. This problem appears if you want to print your detections before you track. --- motpy/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motpy/core.py b/motpy/core.py index e06fd61..fafa5c8 100644 --- a/motpy/core.py +++ b/motpy/core.py @@ -35,7 +35,7 @@ def __init__( self.feature = feature def __repr__(self): - return f'Detection(box={self.box}, score={self.score:.5f}, class_id={self.class_id}, feature={self.feature})' + return f'Detection(box={self.box}, score={f"{self.score:.5f}" if self.score else None}, class_id={self.class_id}, feature={self.feature})' """ utils """ From 42bc6ff6e83d0ea777dd09b1dd7c8fd8bd9552c3 Mon Sep 17 00:00:00 2001 From: fprott Date: Thu, 25 Jul 2024 16:36:53 +0200 Subject: [PATCH 2/2] Update tracker.py Ratio was inverted --- motpy/tracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motpy/tracker.py b/motpy/tracker.py index d5eb9fd..8f8efde 100644 --- a/motpy/tracker.py +++ b/motpy/tracker.py @@ -374,7 +374,7 @@ def active_tracks(self, if cond1 and cond2 and cond3: tracks.append(Track(id=tracker.id, box=tracker.box(), score=tracker.score, class_id=tracker.class_id)) - logger.debug('active/all tracks: %d/%d' % (len(self.trackers), len(tracks))) + logger.debug(f'active/all tracks: {len(tracks)}/{len(self.trackers)}') return tracks def cleanup_trackers(self) -> None: