ncnn yolov5.cpp切换yolov5n6模型(三)
ncnn yolo strip 64的作用,模型参数
·
strip64问题
前面分析到丢掉stride 64参数,会丢失小目标,那实际是不是这样子呢,我们修改yolov5.cpp,参考strip8,16,32的写法,增加strip64代码
// stride 64
{
ncnn::Mat out;
ex.extract("484", out);
ncnn::Mat anchors(6);
anchors[0] = 436;
anchors[1] = 615;
anchors[2] = 739;
anchors[3] = 380;
anchors[4] = 925;
anchors[5] = 792;
std::vector<Object> objects64;
generate_proposals(anchors, 64, in_pad, out, prob_threshold, objects64);
proposals.insert(proposals.end(), objects64.begin(), objects64.end());
}


左:无64参数运行结果--------------右:有64参数运行结果
strip64是否生效
我们通过屏蔽代码,分别得到strip 8/16/32/64运行后得到的框,注意要把nms_threshold降低,防止过滤掉低分数框。


左:only strip8参数运行结果--------------右:only strip16参数运行结果


左:only strip32参数运行结果--------------右:only strip64参数运行结果
当前参数对应
目前对应是这样的
strip 8------output
strip 16------456
strip 32------470
strip 64------484

原demo参数对应
原demo用的yolov5s_6.0对应是这样的
strip 8------output
strip 16------376
strip 32------401

它的5s6只有3层输出,很奇怪。
yolo官网5s6参数
我去yolo github下载yolov5s6.pt,转成onnx,转成.param

yolo官网的5s6也是4层输出。
yolo官网5s参数
我好奇,把官网的5s模型也转了出来

为了再次确认,我把两个模型丢到了https://netron.app/,对比发现一毛一样,那为什么ncnn要把这个模型命名为5S_6.0呢?
未完待续

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)