Skip to content

⚡️ Speed up method STrack.to_xyah by 25% #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions supervision/tracker/byte_tracker/single_object_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ def tlwh_to_xyah(tlwh) -> npt.NDArray[np.float32]:
"""Convert bounding box to format `(center x, center y, aspect ratio,
height)`, where the aspect ratio is `width / height`.
"""
ret = np.asarray(tlwh).copy()
ret[:2] += ret[2:] / 2
ret[2] /= ret[3]
return ret
cx, cy, w, h = tlwh
return np.array([cx + w / 2, cy + h / 2, w / h, h], dtype=np.float32)

def to_xyah(self) -> npt.NDArray[np.float32]:
return self.tlwh_to_xyah(self.tlwh)
return self.tlwh_to_xyah(self._tlwh)

@staticmethod
def tlbr_to_tlwh(tlbr) -> npt.NDArray[np.float32]:
Expand Down