[Python] 纯文本查看 复制代码
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "C:\yolo\yolov5-7.0\detect.py", line 43, in <module>
from models.common import DetectMultiBackend
File "C:\yolo\yolov5-7.0\models\common.py", line 29, in <module>
from utils.dataloaders import exif_transpose, letterbox
File "C:\yolo\yolov5-7.0\utils\dataloaders.py", line 25, in <module>
import torchvision
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\__init__.py", line 6, in <module>
from torchvision import _meta_registrations, datasets, io, models, ops, transforms, utils
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\models\__init__.py", line 2, in <module>
from .convnext import *
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\models\convnext.py", line 8, in <module>
from ..ops.misc import Conv2dNormActivation, Permute
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\ops\__init__.py", line 23, in <module>
from .poolers import MultiScaleRoIAlign
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\ops\poolers.py", line 10, in <module>
from .roi_align import roi_align
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torchvision\ops\roi_align.py", line 4, in <module>
import torch._dynamo
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\__init__.py", line 64, in <module>
torch.manual_seed = disable(torch.manual_seed)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\decorators.py", line 50, in disable
return DisableContext()(fn)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\eval_frame.py", line 410, in __call__
(filename is None or trace_rules.check(fn))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 3378, in check
return check_verbose(obj, is_inlined_call).skipped
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 3361, in check_verbose
rule = torch._dynamo.trace_rules.lookup_inner(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 3442, in lookup_inner
rule = get_torch_obj_rule_map().get(obj, None)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 2782, in get_torch_obj_rule_map
obj = load_object(k)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 2811, in load_object
val = _load_obj_from_str(x[0])
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\_dynamo\trace_rules.py", line 2795, in _load_obj_from_str
return getattr(importlib.import_module(module), obj_name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nested\_internal\nested_tensor.py", line 417, in <module>
values=torch.randn(3, 3, device="meta"),
C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\nested\_internal\nested_tensor.py:417: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84.)
values=torch.randn(3, 3, device="meta"),
detect: weights=['yolov5s.pt'], source=data/images/bus.jpg, data=data\coco128.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 2023-8-5 Python-3.11.8 torch-2.3.1+cpu CPU
Fusing layers...
YOLOv5s summary: 213 layers, 7225885 parameters, 0 gradients, 16.4 GFLOPs
Traceback (most recent call last):
File "C:\yolo\yolov5-7.0\detect.py", line 259, in <module>
main(opt)
File "C:\yolo\yolov5-7.0\detect.py", line 254, in main
run(**vars(opt))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\yolo\yolov5-7.0\detect.py", line 117, in run
im = torch.from_numpy(im).to(model.device)
^^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available