ONNX-YOLOv8-Object-Detection
ONNX-YOLOv8-Object-Detection copied to clipboard
video_object_detection.py issue
Hello,
I simply cloned the repo and tried to run the video_objet_detection.py, but it directly fails with:
$ python3 video_object_detection.py
Traceback (most recent call last):
File "video_object_detection.py", line 4, in <module>
from yolov8 import YOLOv8
File "/home/jetson/git/ONNX-YOLOv8-Object-Detection/yolov8/__init__.py", line 1, in <module>
from .YOLOv8 import YOLOv8
File "/home/jetson/git/ONNX-YOLOv8-Object-Detection/yolov8/YOLOv8.py", line 6, in <module>
from yolov8.utils import xywh2xyxy, draw_detections, multiclass_nms
File "/home/jetson/git/ONNX-YOLOv8-Object-Detection/yolov8/utils.py", line 108, in <module>
def draw_box( image: np.ndarray, box: np.ndarray, color: tuple[int, int, int] = (0, 0, 255),
TypeError: 'type' object is not subscriptable
I had to remove the type description to make it work (i.e. color: tuple[int, int, int] = (0, 0, 255)
turned into color=(0, 0, 255)
Maybe there is a way to fix this that I'm not aware of yet ?
Cheers
For older python version like 3.8 use the following modifications for utils.py
:
- Add
from typing import Tuple
in the file header - Replace
tuple
withTuple
in draw_box and draw_text.
Which Python version do you use?