问题遇到的现象和发生背景
使用python prune.py --percent 0.5 --weights ./runs/train/exp3/weights/last.pt --data ./data/dataset.yaml --cfg ./models/yolov5s.yaml 命令对yolov5s进行剪枝时报错:TypeError: run() got an unexpected keyword argument 'cfg'
运行结果及报错内容
报错内容如下:
yolo: data=./data/dataset.yaml, weights=['./runs/train/exp3/weights/last.pt'], cfg=./models/yolov5s.yaml, percent=0.5, batch_size=32, imgsz=512, conf_thres=0.001, iou_thres=0.6, task=val, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=C:\Users\shuyf\yolov5\runs\val, name=exp, exist_ok=False, half=False, dnn=False
test before prune ...
Traceback (most recent call last):
File "prune.py", line 805, in <module>
main(opt)
File "prune.py", line 775, in main
run(**vars(opt))
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
TypeError: run() got an unexpected keyword argument 'cfg'
我的解答思路和尝试过的方法
在网上查询后未发现解决办法
我想要达到的结果
不报错,顺利剪枝