0
点赞
收藏
分享

微信扫一扫

[deepstream][原创]过滤模型中某些类别


比如deepstream中yolov3是80类别,我只想要person这个类别,其他类别过率掉,怎么搞。这个其实很简单,修改插件源码即可

打开nvdsparsebbox_Yolo.cpp源码加个判断即可

static void addBBoxProposal(const float bx, const float by, const float bw, const float bh,
const uint stride, const uint& netW, const uint& netH, const int maxIndex,
const float maxProb, std::vector<NvDsInferParseObjectInfo>& binfo)
{
NvDsInferParseObjectInfo bbi = convertBBox(bx, by, bw, bh, stride, netW, netH);
if (bbi.width < 1 || bbi.height < 1) return;
bbi.detectionConfidence = maxProb;
bbi.classId = maxIndex;
if(bbi.classId==0)
binfo.push_back(bbi);
}

直接加一句if(bbi.classId==0)即可完成过滤任务!

结果展示:

[deepstream][原创]过滤模型中某些类别_Developer

参考文献:

1.Tried to use classId filtering with "infer-on-class-ids" into primary_gie but not working - DeepStream SDK - NVIDIA Developer Forums

举报

相关推荐

0 条评论