From 99707582bc75a1b7077c2090a0ef717ce54204f2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 17:08:16 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/tracker/byte_tracker/core.py | 25 ++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/supervision/tracker/byte_tracker/core.py b/supervision/tracker/byte_tracker/core.py index 8ddf0963..c7d6ae18 100644 --- a/supervision/tracker/byte_tracker/core.py +++ b/supervision/tracker/byte_tracker/core.py @@ -236,8 +236,7 @@ class ByteTrack: ``` """ tracks = self.update_with_tensors( - tensors=detections2boxes(detections=detections), - masks = detections.mask + tensors=detections2boxes(detections=detections), masks=detections.mask ) detections = Detections.empty() if len(tracks) > 0: @@ -253,16 +252,16 @@ class ByteTrack: detections.confidence = np.array( [t.score for t in tracks], dtype=np.float32 ) - detections.mask = np.array( - [t.mask for t in tracks], dtype=bool - ) + detections.mask = np.array([t.mask for t in tracks], dtype=bool) else: detections.tracker_id = np.array([], dtype=int) return detections - def update_with_tensors(self, tensors: np.ndarray, masks:np.ndarray = None) -> List[STrack]: + def update_with_tensors( + self, tensors: np.ndarray, masks: np.ndarray = None + ) -> List[STrack]: """ Updates the tracker with the provided tensors and returns the updated tracks. @@ -293,8 +292,8 @@ class ByteTrack: masks_hs = masks[remain_inds] masks_ls = masks[inds_second] else: - masks_hs = np.array([None]*len(remain_inds)) - masks_ls = np.array([None]*len(inds_second)) + masks_hs = np.array([None] * len(remain_inds)) + masks_ls = np.array([None] * len(inds_second)) scores_keep = scores[remain_inds] scores_second = scores[inds_second] @@ -304,8 +303,8 @@ class ByteTrack: if len(dets) > 0: """Detections""" detections = [ - STrack(STrack.tlbr_to_tlwh(tlbr), s, c,m) - for (tlbr, s, c,m) in zip(dets, scores_keep, class_ids_keep,masks_hs) + STrack(STrack.tlbr_to_tlwh(tlbr), s, c, m) + for (tlbr, s, c, m) in zip(dets, scores_keep, class_ids_keep, masks_hs) ] else: detections = [] @@ -345,8 +344,10 @@ class ByteTrack: if len(dets_second) > 0: """Detections""" detections_second = [ - STrack(STrack.tlbr_to_tlwh(tlbr), s, c,m) - for (tlbr, s, c, m) in zip(dets_second, scores_second, class_ids_second,masks_ls) + STrack(STrack.tlbr_to_tlwh(tlbr), s, c, m) + for (tlbr, s, c, m) in zip( + dets_second, scores_second, class_ids_second, masks_ls + ) ] else: detections_second = []