Hi,
I am using deepstream-infer-tensor-meta-test sample with primary model.
my config file,
[property]
gpu-id=0
net-scale-factor=1
model-file=Res10.caffemodel
proto-file=Resnet.prototxt
batch-size=2
network-mode=1
process-mode=1
model-color-format=0
num-detected-classes=1
interval=0
gie-unique-id=1
output-blob-names=detection_out;out2
parse-bbox-func-name=NvDsInferParseCustomSSD
custom-lib-path = libnvparsebbox.so
## 0=Detector, 1=Classifier, 2=Segmentation, 100=Other
network-type=0
# Enable tensor metadata output
output-tensor-meta=1
[class-attrs-all]
threshold=0.02
eps=0.2
group-threshold=1
and my custom parser code,
#include <cstring>
#include <iostream>
#include "nvdsinfer_custom_impl.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define CLIP(a,min,max) (MAX(MIN(a, max), min))
extern "C"
bool NvDsInferParseCustomSSD (std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
NvDsInferNetworkInfo const &networkInfo,
NvDsInferParseDetectionParams const &detectionParams,
std::vector<NvDsInferObjectDetectionInfo> &objectList);
bool NvDsInferParseCustomSSD (std::vector<NvDsInferLayerInfo> const &outputLayersInfo,
NvDsInferNetworkInfo const &networkInfo,
NvDsInferParseDetectionParams const &detectionParams,
std::vector<NvDsInferObjectDetectionInfo> &objectList)
{
// int keepCount = *((int *) outputLayersInfo[1].buffer);
// float *detectionOut = (float *) outputLayersInfo[1].buffer;
float *detectionOut = (float *) outputLayersInfo[0].buffer;
for (int i = 0;i<10;i++){
float* det = detectionOut + i * 7;
if (det[2] > 0.2){
NvDsInferObjectDetectionInfo object;
object.classId = 0;
unsigned int rectx1, recty1, rectx2, recty2;
object.detectionConfidence = det[2];
rectx1 = det[3] * networkInfo.width;
recty1 = det[4] * networkInfo.height;
rectx2 = det[5] * networkInfo.width;
recty2 = det[6] * networkInfo.height;
object.left = CLIP(rectx1, 0, networkInfo.width - 1);
object.top = CLIP(recty1, 0, networkInfo.height - 1);
object.width = CLIP(rectx2, 0, networkInfo.width - 1) -object.left + 1;
object.height = CLIP(recty2, 0, networkInfo.height - 1) - object.top + 1;
objectList.push_back(object);
}
}
return true;
}
Video plays with bboxes which is not accurate and changes randomly. How can I interpret correct bbox using custom parser?