• Hardware Platform (GPU)
**• DeepStream Version 6.1
**• TensorRT Version 8.2E
**• NVIDIA GPU Driver Version 515
Dear professor:
I try to get the result of secondary engine. But I failde.
My configure file as below:
[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
[tiled-display]
enable=1
rows=1
columns=1
width=1920
height=1080
gpu-id=0
nvbuf-memory-type=0
[source0]
enable=1
type=3
uri=file:/opt/nvidia/deepstream/deepstream-6.1/sources/CoalSummary/stream/sample_1080p_h264.mp4
num-sources=1
gpu-id=0
cudadec-memtype=0
[source1]
enable=0
type=4
uri=rtsp://admin:AA123456@192.168.1.3
num-sources=1
gpu-id=0
cudadec-memtype=0
[ds-example]
enable=1
processing-width=1024
processing-height=768
full-frame=0
batch-size=1
unique-id=15
gpu-id=0
blur-objects=1
nvbuf-memory-type=3
[sink0]
enable=1
type=4
codec=1
enc-type=0
sync=0
#iframeinterval=10
bitrate=400000
profile=0
rtsp-port=8559
udp-port=5410
[osd]
enable=1
gpu-id=0
border-width=1
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0
[streammux]
gpu-id=0
live-source=0
buffer-pool-size=4
batch-size=4
batched-push-timeout=40000
width=1920
height=1080
enable-padding=0
nvbuf-memory-type=0
[primary-gie]
enable=1
gpu-id=0
model-engine-file=./Primary_Detector/resnet10.caffemodel_b4_gpu0_int8.engine
batch-size=4
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary.txt
[secondary-gie0]
enable=1
model-engine-file=./Secondary_CarColor/resnet18.caffemodel_b16_gpu0_int8.engine
batch-size=16
gpu-id=0
gie-unique-id=5
operate-on-gie-id=1
operate-on-class-ids=0;
config-file=config_infer_secondary_carcolor.txt
[tracker]
enable=1
tracker-width=640
tracker-height=384
ll-lib-file=/opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
ll-config-file=config_tracker_NvDCF_perf.yml
gpu-id=0
enable-batch-process=1
enable-past-frame=1
display-tracking-id=1
[tests]
file-loop=1
I accorde to “deesptream_infer_tensor_meta_test.cpp → sgie_pad_buffer_probe”, And add the code to dsexample-> gst_dsexample_tranform_ip as below:
static GstFlowReturn
gst_dsexample_transform_ip (GstBaseTransform * btrans, GstBuffer * inbuf)
{
GstDsExample *dsexample = GST_DSEXAMPLE (btrans);
GstMapInfo in_map_info;
GstFlowReturn flow_ret = GST_FLOW_ERROR;
gdouble scale_ratio = 1.0;
DsExampleOutput *output;
NvBufSurface *surface = NULL;
NvDsBatchMeta *batch_meta = NULL;
NvDsFrameMeta *frame_meta = NULL;
NvDsMetaList * l_frame = NULL;
guint i = 0;
CHECK_CUDA_STATUS (cudaSetDevice (dsexample->gpu_id), “Unable to set cuda device”);
memset (&in_map_info, 0, sizeof (in_map_info));
if (!gst_buffer_map (inbuf, &in_map_info, GST_MAP_READ)) {
g_print (“Error: Failed to map gst buffer\n”);
goto error;
}
nvds_set_input_system_timestamp (inbuf, GST_ELEMENT_NAME (dsexample));
surface = (NvBufSurface *) in_map_info.data;
GST_DEBUG_OBJECT (dsexample,
“Processing Frame %” G_GUINT64_FORMAT " Surface %p\n",
dsexample->frame_num, surface);
if (CHECK_NVDS_MEMORY_AND_GPUID (dsexample, surface))
goto error;
batch_meta = gst_buffer_get_nvds_batch_meta (inbuf);
if (batch_meta == nullptr) {
GST_ELEMENT_ERROR (dsexample, STREAM, FAILED,
(“NvDsBatchMeta not found for input buffer.”), (NULL));
return GST_FLOW_ERROR;
}
if (1)
{
/* Using object crops as input to the algorithm. The objects are detected by
* the primary detector */
NvDsMetaList * l_obj = NULL;
NvDsObjectMeta *obj_meta = NULL;
for (l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next)
{
frame_meta = (NvDsFrameMeta *) (l_frame->data);
for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next)
{
obj_meta = (NvDsObjectMeta *) (l_obj->data);
/* Iterate user metadata in object to search SGIE's tensor data */
cout<<"obj_meta->obj_user_meta_list="<< obj_meta->obj_user_meta_list <<endl;
for (NvDsMetaList * l_user = obj_meta->obj_user_meta_list; l_user != NULL; l_user = l_user->next)
{
//======= Here I hope to print=====//
cout<<"I am here"<<endl;
NvDsUserMeta *user_meta = (NvDsUserMeta *) l_user->data;
if (user_meta->base_meta.meta_type != NVDSINFER_TENSOR_OUTPUT_META)
continue;
}
output = DsExampleProcess (dsexample->dsexamplelib_ctx,
(unsigned char *)dsexample->inter_buf->surfaceList[0].mappedAddr.addr[0]);
/* Attach labels for the object */
attach_metadata_object (dsexample, obj_meta, output);
free (output);
}
}
}
flow_ret = GST_FLOW_OK;
error:
nvds_set_output_system_timestamp (inbuf, GST_ELEMENT_NAME (dsexample));
gst_buffer_unmap (inbuf, &in_map_info);
return flow_ret;
}
I hope to print the “obj_meta->obj_user_meta_list”, but result is 0.
What is wrong?
My secondary engine confige as below:
[property]
gpu-id=0
net-scale-factor=1
model-file=./Secondary_CarColor/resnet18.caffemodel
proto-file=./Secondary_CarColor/resnet18.prototxt
model-engine-file=./Secondary_CarColor/resnet18.caffemodel_b16_gpu0_int8.engine
int8-calib-file=./Secondary_CarColor/cal_trt.bin
mean-file=./Secondary_CarColor/mean.ppm
labelfile-path=./Secondary_CarColor/labels.txt
force-implicit-batch-dim=1
batch-size=16
model-color-format=1
process-mode=2
0=FP32, 1=INT8, 2=FP16 mode
network-mode=1
is-classifier=1
output-blob-names=predictions/Softmax
classifier-async-mode=0
classifier-threshold=0.51
input-object-min-width=60
input-object-min-height=60
operate-on-gie-id=1
operate-on-class-ids=0
classifier-type=carcolor
#scaling-filter=0
#scaling-compute-hw=0
Please help me. Thank you very much.