gaohaichao123 2022-01-01 23:02 采纳率: 100%
浏览 324
已结题

python 运行错误,如何解决?

python 运行错误,如何解决?



训练出现错误
(lajifenleiAI) D:\dejahu\网课YOLOv5实战垃圾分类\YOLOv5\yolov5-5.0-trash>python train.py --data data/voc_trash.yaml --cfg models/yolov5s_trash.yaml -- weights weights/yolov5s.pt --batch-size 16 --epochs 120  --workers 4 --name base
usage: train.py [-h] [--weights WEIGHTS] [--cfg CFG] [--data DATA] [--hyp HYP]
                [--epochs EPOCHS] [--batch-size BATCH_SIZE]
                [--img-size IMG_SIZE [IMG_SIZE ...]] [--rect]
                [--resume [RESUME]] [--nosave] [--notest] [--noautoanchor]
                [--evolve] [--bucket BUCKET] [--cache-images]
                [--image-weights] [--device DEVICE] [--multi-scale]
                [--single-cls] [--adam] [--sync-bn] [--local_rank LOCAL_RANK]
                [--workers WORKERS] [--project PROJECT] [--entity ENTITY]
                [--name NAME] [--exist-ok] [--quad] [--linear-lr]
                [--label-smoothing LABEL_SMOOTHING] [--upload_dataset]
                [--bbox_interval BBOX_INTERVAL] [--save_period SAVE_PERIOD]
                [--artifact_alias ARTIFACT_ALIAS]
train.py: error: unrecognized arguments: -- weights weights/yolov5s.pt --batch-size 16 --epochs 120 --workers 4 --name base


运行出现错误

D:\ProgramData\Anaconda3\envs\lajifenleiAI\python.exe D:/dejahu/网课YOLOv5实战垃圾分类/yolov5-5.0-trash/detect.py
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, line_thickness=3, max_det=1000, name='exp', nosave=False, project='runs/detect', save_conf=False, save_crop=False, save_txt=False, source='data/images', update=False, view_img=False, weights='yolov5s.pt')
YOLOv5  2021-5-23 torch 1.10.1+cpu CPU

Traceback (most recent call last):
  File "D:/dejahu/网课YOLOv5实战垃圾分类/yolov5-5.0-trash/detect.py", line 185, in <module>
    detect(opt=opt)
  File "D:/dejahu/网课YOLOv5实战垃圾分类/yolov5-5.0-trash/detect.py", line 33, in detect
    model = attempt_load(weights, map_location=device)  # load FP32 model
  File "D:\dejahu\网课YOLOv5实战垃圾分类\yolov5-5.0-trash\models\experimental.py", line 120, in attempt_load
    ckpt = torch.load(w, map_location=map_location)  # load
  File "D:\ProgramData\Anaconda3\envs\lajifenleiAI\lib\site-packages\torch\serialization.py", line 607, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "D:\ProgramData\Anaconda3\envs\lajifenleiAI\lib\site-packages\torch\serialization.py", line 882, in _load
    result = unpickler.load()
  File "D:\ProgramData\Anaconda3\envs\lajifenleiAI\lib\site-packages\torch\serialization.py", line 875, in find_class
    return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from 'D:\\dejahu\\网课YOLOv5实战垃圾分类\\yolov5-5.0-trash\\models\\common.py'>

进程已结束,退出代码1

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 1月10日
  • 已采纳回答 1月2日
  • 创建了问题 1月1日

悬赏问题

  • ¥20 电脑拓展屏桌面被莫名遮挡
  • ¥20 ensp,用局域网解决
  • ¥15 Python语言实验
  • ¥15 我每周要在投影仪优酷上自动连续播放112场电影,我每一周遥控操作一次投影仪,并使得电影永远不重复播放,请问怎样操作好呢?有那么多电影看吗?
  • ¥20 电脑重启停留在grub界面,引导出错需修复
  • ¥15 matlab透明图叠加
  • ¥50 基于stm32l4系列 使用blunrg-ms的ble gatt 创建 hid 服务失败
  • ¥150 计算DC/DC变换器平均模型中的参数mu
  • ¥25 C语言代码,大家帮帮我
  • ¥50 关于#html5#的问题:H5页面用户手机返回的时候跳转到指定页面例如(语言-javascript)