MuhammadMoinFaisal / YOLOv8-DeepSORT-Object-Tracking

YOLOv8 Object Tracking using PyTorch, OpenCV and DeepSORT

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError: Couldn't load custom C++ ops.

mmmstew opened this issue · comments

I get the following error when running on Jetson Orin Nano development kit:

user@user-orin:~/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect$ python predict.py model=yolov8l.pt source="test3.mp4" show=True
/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: '/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/image.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
[2023-07-22 14:57:40,246][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
Ultralytics YOLOv8.0.3 🚀 Python-3.8.10 torch-2.0.1 CPU
Fusing layers...
YOLOv8l summary: 268 layers, 43668288 parameters, 0 gradients, 165.2 GFLOPs
Error executing job with overrides: ['model=yolov8l.pt', 'source=test3.mp4', 'show=True']
Traceback (most recent call last):
File "predict.py", line 253, in predict
predictor()
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 183, in call
preds = self.postprocess(preds, im, im0s)
File "predict.py", line 181, in postprocess
preds = ops.non_max_suppression(preds,
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/utils/ops.py", line 212, in non_max_suppression
i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS
File "/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/ops/boxes.py", line 40, in nms
_assert_has_ops()
File "/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/extension.py", line 48, in _assert_has_ops
raise RuntimeError(
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.version and your torchvision version with torchvision.version and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I have checked the Runtime error suggetion following the link https://github.com/pytorch/vision#installation and the following versions should be compatible:

  • Python 3.8.10
  • pytorch 2.0.1
  • torchvision 0.15.1a0+42759b1

As pytorch was not installed with CUDA, I uninstalled and corrected this. Now I have:
pytorch 2.0.0+nv23.05
torchvision 0.15.1a0+42759b1

Now I have the following error:

user@user-orin:~/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect$ python3 predict.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "predict.py", line 13, in
from ultralytics.yolo.engine.predictor import BasePredictor
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/init.py", line 5, in
from ultralytics.hub import checks
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/hub/init.py", line 10, in
from ultralytics.hub.auth import Auth
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/hub/auth.py", line 5, in
from ultralytics.hub.utils import HUB_API_ROOT, request_with_credentials
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/hub/utils.py", line 10, in
from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, TryExcept, colorstr, emojis
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/utils/init.py", line 400, in
SETTINGS = get_settings()
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/utils/init.py", line 371, in get_settings
with torch_distributed_zero_first(RANK):
File "/usr/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/utils/torch_utils.py", line 34, in torch_distributed_zero_first
initialized = torch.distributed.is_initialized() # prevent 'Default process group has not been initialized' errors
AttributeError: module 'torch.distributed' has no attribute 'is_initialized'

In Python3:

torch.distributed.is_available()
False

Is there a way to fix this?