Running the run.py on another machine I was able to get the script better working after installing
opencv-python-headless, but the script still fails with missing models/ball.pt
āā> python run.py --video ./REC_0014.MP4
cpu
Using cache found in /home/waboring/.cache/torch/hub/ultralytics_yolov5_master
YOLOv5 š 2023-8-7 Python-3.10.11 torch-1.12.1+cu102 CPU
Fusing layers...
YOLOv5x summary: 444 layers, 86705005 parameters, 0 gradients
Adding AutoShape...
cpu
Using cache found in /home/waboring/.cache/torch/hub/ultralytics_yolov5_master
YOLOv5 š 2023-8-7 Python-3.10.11 torch-1.12.1+cu102 CPU
Traceback (most recent call last):
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 49, in _create
model = DetectMultiBackend(path, device=device, fuse=autoshape) # detection model
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 344, in __init__
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/models/experimental.py", line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 211, in __init__
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'models/ball.pt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 60, in _create
model = attempt_load(path, device=device, fuse=False) # arbitrary model
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/models/experimental.py", line 79, in attempt_load
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 230, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/serialization.py", line 211, in __init__
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'models/ball.pt'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/waboring/test/soccer-video-analytics/run.py", line 49, in <module>
ball_detector = YoloV5(model_path=args.model)
File "/home/waboring/test/soccer-video-analytics/inference/yolov5.py", line 27, in __init__
self.model = torch.hub.load("ultralytics/yolov5", "custom", path=model_path)
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/hub.py", line 540, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "/home/waboring/test/.venv/lib/python3.10/site-packages/torch/hub.py", line 569, in _load_local
model = entry(*args, **kwargs)
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 83, in custom
return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
File "/home/waboring/.cache/torch/hub/ultralytics_yolov5_master/hubconf.py", line 78, in _create
raise Exception(s) from e
Exception: [Errno 2] No such file or directory: 'models/ball.pt'. Cache may be out of date, try `force_reload=True` or see https://docs.ultralytics.com/yolov5/tutorials/pytorch_hub_model_loading for help.
Running the run.py on another machine I was able to get the script better working after installing opencv-python-headless, but the script still fails with missing models/ball.pt