Closed boschmonart closed 3 months ago
The example:
import cv2
import numpy as np
from pathlib import Path
from boxmot import DeepOCSORT
tracker = DeepOCSORT(
model_weights=Path('osnet_x0_25_msmt17.pt'), # which ReID model to use
device='mps',
fp16=False,
)
vid = cv2.VideoCapture(0)
while True:
ret, im = vid.read()
# substitute by your object detector, output has to be N X (x, y, x, y, conf, cls)
dets = np.array([[144, 212, 578, 480, 0.82, 0]])
# Check if there are any detections
if dets.size > 0:
tracker.update(dets, im) # --> M X (x, y, x, y, id, conf, cls, ind)
# If no detections, make prediction ahead
else:
dets = np.empty((0, 6)) # empty N X (x, y, x, y, conf, cls)
tracker.update(dets, im) # --> M X (x, y, x, y, id, conf, cls, ind)
tracker.plot_results(im, show_trajectories=True)
# break on pressing q or space
cv2.imshow('BoxMOT detection', im)
key = cv2.waitKey(1) & 0xFF
if key == ord(' ') or key == ord('q'):
break
vid.release()
cv2.destroyAllWindows()
works fine for me 😄 . det = [[1,2,3,4,0.5]]
should be det = [[1,2,3,4,0,5]]
?
cool, yepp, that works.
thanks for the quick response
Then my issue would be with doc string of the func for both DeepOCSort & OCSORT
current
"""
Params:
dets - a numpy array of detections in the format [[x1,y1,x2,y2,score],[x1,y1,x2,y2,score],...]
Requires: this method must be called once for each frame even with empty detections
(use np.empty((0, 5)) for frames without detections).
Returns the a similar array, where the last column is the object ID.
NOTE: The number of objects returned may differ from the number of detections provided.
"""
desired
"""
Params:
dets - a numpy array of detections in the format [[x1,y1,x2,y2,score,class],[x1,y1,x2,y2,score,class],...]
Requires: this method must be called once for each frame even with empty detections
(use np.empty((0, 6)) for frames without detections).
Returns the a similar array, where the last column is the object ID.
NOTE: The number of objects returned may differ from the number of detections provided.
"""
Will move out all the shape checks to the base class and correct this typo
👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Search before asking
Yolo Tracking Component
Tracking
Bug
hi, i'm using OCSORT. Doc for update says
but then, checks
why? is the docString wrong, and the class should be passed? [x1,y1,x2,y2,score, class] or the shape check should be shape[1] == 6
thanks
Environment
yolov8
Minimal Reproducible Example