ZJU-lishuang / yolov5_prune

yolov5 prune,Support V2, V3, V4 and V6 versions of yolov5
Apache License 2.0
556 stars 136 forks source link

为什么稀疏训练后的权重文件有54.1M #79

Closed ztrong-forever closed 2 years ago

ztrong-forever commented 2 years ago

python train_sparsity.py --img 640 --batch 16 --epochs 50 --data data/coco_hand.yaml --cfg models/yolov5s.yaml --weights runs/train/s_hand/weights/last.pt --name s_hand_sparsity -sr --s 0.001 --prune 0

而且这个--s参数没有啊,大佬帮忙看看什么问题

ZJU-lishuang commented 2 years ago
        s换成scale了,模型大小问题看保存模型的地方,或者你跑完流程---- 回复的原邮件 ***@***.***>发送日期2022年01月05日 18:12 ***@***.***> ***@***.***>主题Re: [ZJU-lishuang/yolov5_prune] 为什么稀疏训练后的权重文件有54.1M (Issue #79)

Closed #79.

—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.> [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/ZJU-lishuang/yolov5_prune/issues/79#event-5845454111", "url": "https://github.com/ZJU-lishuang/yolov5_prune/issues/79#event-5845454111", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

ztrong-forever commented 2 years ago

您好大佬,我用的是您yolov5 6.0的版本,是不是跑完50轮才会看出结果,我只训了几轮看权重大小的

ZJU-lishuang commented 2 years ago
        看代码保存模型的地方---- 回复的原邮件 ***@***.***>发送日期2022年01月05日 18:22 ***@***.***> ***@***.******@***.***>主题Re: [ZJU-lishuang/yolov5_prune] 为什么稀疏训练后的权重文件有54.1M (Issue #79)

您好大佬,我用的是您yolov5 6.0的版本,是不是跑完50轮才会看出结果,我只训了几轮看权重大小的

—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you commented.Message ID: @.***>

[

{

@.***": "http://schema.org",

@.***": "EmailMessage",

"potentialAction": {

@.***": "ViewAction",

"target": "https://github.com/ZJU-lishuang/yolov5_prune/issues/79#issuecomment-1005558307",

"url": "https://github.com/ZJU-lishuang/yolov5_prune/issues/79#issuecomment-1005558307",

"name": "View Issue"

},

"description": "View this Issue on GitHub",

"publisher": {

@.***": "Organization",

"name": "GitHub",

"url": "https://github.com"

}

}

]

ztrong-forever commented 2 years ago

image 没太懂啊大佬,这个和train.py保存模型一样的

ZJU-lishuang commented 2 years ago

strip_optimizer函数优化模型存储。 哎,以前是写在外面的,现在封装越来越严重了

ztrong-forever commented 2 years ago

您好,关掉之后还是有23M啊

ZJU-lishuang commented 2 years ago

关掉?strip_optimizer这个函数是最后才跑的,模型跑完这个函数才会去掉不需要的参数

ztrong-forever commented 2 years ago

image 您好大佬!那这个该怎么改啊,直接注释掉还是要怎么样

ZJU-lishuang commented 2 years ago

参考strip_optimizer函数,或者你epoch设置成1快速跑完看看最后模型大小

ztrong-forever commented 2 years ago

解决了,感谢大佬!!!我太菜了-_-

ZJU-lishuang commented 2 years ago

感觉你代码都没怎么看,多看看代码思路,问题不会无缘无故的

ztrong-forever commented 2 years ago

好的大佬,后面一定好好看