coldlarry / YOLOv3-complete-pruning

提供对YOLOv3及Tiny的多种剪枝版本,以适应不同的需求。
793 stars 214 forks source link

模型可以保存为.weights格式吗 #37

Open lilei1128 opened 4 years ago

lilei1128 commented 4 years ago

剪枝后的模型可以保存为darknet读取的模型格式.weights格式吗??

coldlarry commented 4 years ago

可以

------------------ 原始邮件 ------------------ 发件人: "lilei1128"<notifications@github.com>; 发送时间: 2019年12月11日(星期三) 下午4:36 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

剪枝后的模型可以保存为darknet读取的模型格式.weights格式吗??

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

lilei1128 commented 4 years ago

好的,我从models.py中看到了save weights函数了,具体还没有复现,等我复现遇到问题再反馈给您,谢谢回复!

---原始邮件--- 发件人: "coldlarry"<notifications@github.com> 发送时间: 2019年12月11日(星期三) 下午4:42 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

可以

------------------&nbsp;原始邮件&nbsp;------------------ 发件人:&nbsp;"lilei1128"<notifications@github.com&gt;; 发送时间:&nbsp;2019年12月11日(星期三) 下午4:36 收件人:&nbsp;"coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com&gt;; 抄送:&nbsp;"Subscribed"<subscribed@noreply.github.com&gt;; 主题:&nbsp;[coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

剪枝后的模型可以保存为darknet读取的模型格式.weights格式吗??

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

lilei1128 commented 4 years ago

问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用?

ZHEQIUSHUI commented 4 years ago

问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用?

你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗

lilei1128 commented 4 years ago

具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。

---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月18日(星期三) 下午5:29 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用?

你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZHEQIUSHUI commented 4 years ago

具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。 ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月18日(星期三) 下午5:29 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用? 你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

那我将稀疏剪枝后的模型正常训练一番,是不是可以用了......谢谢 我试试看

lilei1128 commented 4 years ago

好的这个我倒是没有试过,如果可以的话方便告诉我一声。

---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月19日(星期四) 上午9:57 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。 … ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月18日(星期三) 下午5:29 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用? 你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

那我将稀疏剪枝后的模型正常训练一番,是不是可以用了......谢谢 我试试看

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZHEQIUSHUI commented 4 years ago

好的这个我倒是没有试过,如果可以的话方便告诉我一声。 ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月19日(星期四) 上午9:57 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。 … ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月18日(星期三) 下午5:29 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用? 你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. 那我将稀疏剪枝后的模型正常训练一番,是不是可以用了......谢谢 我试试看 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

答案是不行的....

lilei1128 commented 4 years ago

好吧 难受😭

---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月19日(星期四) 中午11:26 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

好的这个我倒是没有试过,如果可以的话方便告诉我一声。 … ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月19日(星期四) 上午9:57 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。 … ---原始邮件--- 发件人: "Arno"<notifications@github.com> 发送时间: 2019年12月18日(星期三) 下午5:29 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37) 问一下,保存的.weights模型在darknet中调用什么都检测不到,但是在你的项目中map还挺高,相同的图片也能检测到目标。这是怎么回事? 还是生成的.weights模型,不能被darknet调用? 你好我也有相同的问题...在原版的darknet中没有结果 请问你找到解决办法了吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. 那我将稀疏剪枝后的模型正常训练一番,是不是可以用了......谢谢 我试试看 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

答案是不行的....

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ZHEQIUSHUI commented 4 years ago

找到办法了,可以得到结果,但是thresh需要设置得很低。

VideoCapture cap(0);
Mat src;
Detector detector("YOLOv3-complete-pruning/cfg/prune_0.5_prune_0.5_yolov3-hand.cfg"
                      ,"YOLOv3-complete-pruning/weights/hand_best.weights");
while (1) {
    if(!cap.read(src))
        break;
    auto result = detector.detect(src,0.001);
    for (auto&obj:result) {
        rectangle(src,Rect(obj.x,obj.y,obj.w,obj.h),Scalar(0,0,255),2);
    }
    imshow("",src);
    if(waitKey(1)==27)
        break;
}
WY51BE commented 4 years ago

请问一下,经过剪枝后,是可以得到剪枝后的cfg文件和对应剪枝后cfg文件的weights文件吗

lilei1128 commented 4 years ago

可以

---原始邮件--- 发件人: "Wu"<notifications@github.com> 发送时间: 2020年3月15日(周日) 晚上9:07 收件人: "coldlarry/YOLOv3-complete-pruning"<YOLOv3-complete-pruning@noreply.github.com>; 抄送: "Author"<author@noreply.github.com>;"lilei1128"<1715734693@qq.com>; 主题: Re: [coldlarry/YOLOv3-complete-pruning] 模型可以保存为.weights格式吗 (#37)

请问一下,经过剪枝后,是可以得到剪枝后的cfg文件和对应剪枝后cfg文件的weights文件吗

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

RosabanksiaeAit commented 4 years ago

@coldlarry :请问您在yolov3-quantize-hand.cfg这个 文件中,为何yolo层前的卷积层没有改为量化的卷积层?是因为yolo层前的卷积层有什么特殊性吗?

alisonzhang88 commented 3 years ago

具体问题还没有解决呢,但是我试了一下如果正常训练的话保存的.weights可以在darknet中使用,但是稀疏化和剪枝之后的模型好像还是不能用。

我也遇到一摸一样的问题,请问现在有解决方法不?