YOLOV3 测试图像添加置信度
int i,j;
for(i = 0; i < num; ++i){
char labelstr[4096] = {0};
int class = -1;
char possible[10];//存放检测的置信值
for(j = 0; j < classes; ++j){
sprintf(possible,"%.2f",dets[i].prob[j]);//置信值截取小数点后两位赋给possible
if (dets[i].prob[j] > thresh){
if (class < 0) {
strcat(labelstr, names[j]);
strcat(labelstr, possible);//标签中加入置信值
class = j;
} else {
strcat(labelstr, ", ");
strcat(labelstr, names[j]);
strcat(labelstr, possible);//标签中加入置信值
}
printf("%s: %.0f%%\n", names[j], dets[i].prob[j]*100);
}
}
记着一定重新编译
make clean
make -j32