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