Hi,
First of all, thanks for the nice package.
It seems there is a discrepancy in the input / output format where input is expected as [left, top, right, bottom] as per lines:
and comment:
|
# Convert nx4 boxes from [x1, y1, x2, y2] to [x, y, w, h] where xy1=top-left, xy2=bottom-right |
But outputs are send back as [center left, center top, right, bottom] as per line:
and definition of:
Steps to reproduce:
import numpy as np
from bytetracker import BYTETracker
h, w, n = 480, 640, 10
boxes = np.hstack([np.random.randint(0, w, n)[..., np.newaxis],
np.random.randint(0, h, n)[..., np.newaxis],
np.random.randint(0, w, n)[..., np.newaxis],
np.random.randint(0, h, n)[..., np.newaxis]])
scores = 0.8 + 0.2 * np.random.random(n)[..., np.newaxis]
classes = np.zeros((n, 1))
dets = np.hstack([boxes, scores, classes])
tracker = BYTETracker()
online_targets = tracker.update(dets)
np.allclose(boxes, online_targets[:, :4])
results in >> False with the actual code.
Potential fix, if [left, top, right, bottom] is the way to go with:
def xywh2xyxy(x):
# Convert nx4 boxes from [x, y, w, h] to [x1, y1, x2, y2] where xy1=top-left, xy2=bottom-right
try:
y = x.clone()
except:
y = np.copy(x)
y[:, 0] = x[:, 0] # top left x
y[:, 1] = x[:, 1] # top left y
y[:, 2] = x[:, 0] + x[:, 2] # bottom right x
y[:, 3] = x[:, 1] + x[:, 3] # bottom right y
return y
Again, thanks for the package.
Hi,
First of all, thanks for the nice package.
It seems there is a discrepancy in the input / output format where input is expected as
[left, top, right, bottom]as per lines:bytetrack-pip/bytetracker/byte_tracker.py
Line 215 in 61a06fe
and comment:
bytetrack-pip/bytetracker/byte_tracker.py
Line 33 in 61a06fe
But outputs are send back as
[center left, center top, right, bottom]as per line:bytetrack-pip/bytetracker/byte_tracker.py
Line 372 in 61a06fe
and definition of:
bytetrack-pip/bytetracker/byte_tracker.py
Line 7 in 61a06fe
Steps to reproduce:
results in
>> Falsewith the actual code.Potential fix, if
[left, top, right, bottom]is the way to go with:Again, thanks for the package.