关注 码龄 粉丝数 原力等级 -- 被采纳 被点赞 采纳率 双泉东 2024-06-11 16:13
采纳率: 0%
浏览 11 首页/
人工智能
/ yolov5训练自己的数据集但推理报错 pytorch目标检测人工智能
用yolov5训练自己的数据集,口罩检测,训练结果保存在data/train/exp/下面,然而执行detect.py脚本报了如下错误,可能是什么原因呢?git clone 最新的代码难道有bug?
python detect.py --weights runs/train/exp8/weights/last.pt /work/kouzhao/images/train2017/13_Interview_Interview_Sequences_13_809.jpg
detect: weights=['runs/train/exp8/weights/last.pt', '/work/kouzhao/images/train2017/13_Interview_Interview_Sequences_13_809.jpg'], source=data/images, 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_csv=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 🚀 v7.0-318-gc0380fd8 Python-3.10.13 torch-2.2.1 CUDA:0 (NVIDIA GeForce GTX 1060 6GB, 6073MiB)
Fusing layers...
YOLOv5s summary: 157 layers, 7015519 parameters, 0 gradients, 15.8 GFLOPs
Traceback (most recent call last):
File "/work/yolov5/detect.py", line 312, in
main(opt)
File "/work/yolov5/detect.py", line 307, in main
run(**vars(opt))
File "/opt/conda/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/work/yolov5/detect.py", line 115, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
File "/work/yolov5/models/common.py", line 467, in __init__
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
File "/work/yolov5/models/experimental.py", line 98, in attempt_load
ckpt = torch.load(attempt_download(w), map_location="cpu") # load
File "/opt/conda/lib/python3.10/site-packages/torch/serialization.py", line 1040, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/opt/conda/lib/python3.10/site-packages/torch/serialization.py", line 1258, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '\xff'.
展开全部
收起
写回答
好问题
0 提建议
追加酬金
关注问题
微信扫一扫 点击复制链接 分享 邀请回答
编辑 收藏 删除 结题 收藏 举报 追加酬金 (90%的用户在追加酬金后获得了解决方案) 当前问题酬金 ¥ 0
(可追加 ¥500)
¥ 15¥ 20¥ 50¥ 100¥ 200 支付方式 扫码支付
二维码出错
点击刷新
支付金额
15 元
提供问题酬金的用户不参与问题酬金结算和分配
支付即为同意
《付费问题酬金结算规则》 结题 再想想 删除 再等等