Closed TuanBao0711 closed 1 year ago
I tried many ways such as delete "dets = np.array(results)" or modify some codes, but not work :((
results = Model(im)
for result in results:
boxes = result.boxes.xyxy
confs = result.boxes.conf
cls = result.boxes.cls
# convert PyTorch to NumPy
boxes_np = boxes.cpu().numpy()
confs_np = confs.cpu().numpy()
cls_np = cls.cpu().numpy()
detection_results = np.column_stack((boxes_np, confs_np, cls_np))
tracks = tracker.update(detection_results, im) # --> (x, y, x, y, id, conf, cls, ind)
If you are using a Yolov8 custom model you can use track.py
under the examples
folder
results = Model(im) for result in results: boxes = result.boxes.xyxy confs = result.boxes.conf cls = result.boxes.cls # convert PyTorch to NumPy boxes_np = boxes.cpu().numpy() confs_np = confs.cpu().numpy() cls_np = cls.cpu().numpy() detection_results = np.column_stack((boxes_np, confs_np, cls_np)) tracks = tracker.update(detection_results, im) # --> (x, y, x, y, id, conf, cls, ind)
thanks you, it work ^^
If you are using a Yolov8 custom model you can use
track.py
under theexamples
folder
Sure, I could run the track.py file, however I would like to see your code and customize the code to use algorithms like bytrack, strongsort, or ocsort in my project. Is that allowed? :((
👋 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
Question
I am trying custom object detection model example with on base of you file but not work
tracker = DeepOCSORT( model_weights=Path('osnet_x0_25_msmt17.pt'), # which ReID model to use device='cuda:0', fp16=True, )
vid = cv2.VideoCapture(0) color = (0, 0, 255) # BGR thickness = 2 fontscale = 0.5
Model = YOLO('yolov8n.pt')
while True: ret, im = vid.read()
=> Traceback (most recent call last): File "C:\Users\TuanBao\yolo_tracking\main.py", line 35, in
dets = np.array(results)
ValueError: setting an array element with a sequence. The requested array would exceed the maximum number of dimension of 32.
How Can I fix that, thanks