比如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)即可完成过滤任务!
结果展示:
参考文献:
1.Tried to use classId filtering with "infer-on-class-ids" into primary_gie but not working - DeepStream SDK - NVIDIA Developer Forums