IndexError: too many indices for tensor of dimension 1

使用YoloV5和DeepSort做目标检测跟踪的时候,将视频流切换到了树莓派的网络摄像头,报以下错误

Traceback (most recent call last):
  File ".\demo_simple.py", line 77, in 
    demo.detect()
  File ".\demo_simple.py", line 58, in detect
    track_bboxes = tracker_l.update_tracker(frame, yolo_bboxes)
  File "I:\Documents\Machine Learning\0基础趣味CV项目\实战项目7:YOLOv5+Deepsort 道路车辆分析\2.deepsort\highway_detection.py", line 133, in update_tracker
    outputs = self.deepsort.update(xywhs, confss, clss, image)
  File "I:\Documents\Machine Learning\0基础趣味CV项目\实战项目7:YOLOv5+Deepsort 道路车辆分析\2.deepsort\deep_sort\deep_sort\deep_sort.py", line 32, in update
    bbox_tlwh = self._xywh_to_tlwh(bbox_xywh)
  File "I:\Documents\Machine Learning\0基础趣味CV项目\实战项目7:YOLOv5+Deepsort 道路车辆分析\2.deepsort\deep_sort\deep_sort\deep_sort.py", line 55, in _xywh_to_tlwh
    bbox_tlwh[:, 0] = bbox_xywh[:, 0] - bbox_xywh[:, 2]/2.
IndexError: too many indices for tensor of dimension 1

最后在GitHub找到了原因

IndexError: too many indices for tensor of dimension 1_第1张图片

原因是当前画面中检测框数目为空

 

你可能感兴趣的:(目标跟踪,深度学习,计算机视觉)