Hello yuweiw, Thank you for your response.
I have added the nvds-analytics module to my config file:
enable=1
config-file=/custom_workspace/nvds_analytics/nvdsanalytics_config_custom.txt
So I can now see the counts I want on screen but I so far I am not recieving them in kafka.
My sink config is:
enable=1
type=6
sync=0
gpu-id=0
new-api=0
nvbuf-memory-type=0
msg-conv-config=/custom_workspace/custom_msg_broker_config/cfg_conv.txt
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream-7.1/lib/libnvds_kafka_proto.so
msg-broker-conn-str=kafka;29092;deepstream_native_app
msg-broker-config=/custom_workspace/custom_msg_broker_config/cfg_kafka.txt
topic=deepstream_native_app
msg-conv-frame-interval=1
You can see that I prefer to you the PAYLOAD_DEEPSTREAM_MINIMAL schema as I have already made modifications to the default test5 app to send detection and tracking metadata using the existing metadata like so:
generate_vehicle_meta (gpointer data, gint class_id)
{
NvDsVehicleObject *obj = (NvDsVehicleObject *) data;
// convert class_id to string
char class_id_str[10];
sprintf(class_id_str, "%d", class_id);
obj->type = g_strdup (class_id_str);
obj->color = g_strdup ("");
obj->make = g_strdup ("");
obj->model = g_strdup ("");
obj->license = g_strdup ("");
obj->region = g_strdup ("");
}
static void
generate_event_msg_meta (AppCtx * appCtx, gpointer data, gint class_id, gboolean useTs,
GstClockTime ts, gchar * src_uri, gint stream_id, guint sensor_id,
NvDsObjectMeta * obj_params, float scaleW, float scaleH,
NvDsFrameMeta * frame_meta)
{
//print all meta data to visualize
// g_print("stream_id: %d\n", stream_id);
// g_print("sensor_id: %d\n", sensor_id);
// g_print("frame_meta->frame_num: %d\n", frame_meta->frame_num);
// g_print("obj_params->class_id: %d\n", obj_params->class_id);
// g_print("obj_params->confidence: %f\n", obj_params->confidence);
// g_print("obj_params->rect_params.left: %d\n", obj_params->rect_params.left * scaleW);
// g_print("obj_params->rect_params.top: %d\n", obj_params->rect_params.top * scaleH);
// g_print("obj_params->rect_params.width: %d\n", obj_params->rect_params.width * scaleW);
// g_print("obj_params->rect_params.height: %d\n", obj_params->rect_params.height * scaleH);
// g_print("obj_params->object_id: %d\n", obj_params->object_id);
NvDsEventMsgMeta *meta = (NvDsEventMsgMeta *) data;
meta->objType = NVDS_OBJECT_TYPE_VEHICLE;
meta->objClassId = obj_params->class_id;
NvDsVehicleObject *obj =
(NvDsVehicleObject *) g_malloc0 (sizeof (NvDsVehicleObject));
generate_vehicle_meta (obj,class_id);
meta->extMsg = obj;
meta->extMsgSize = sizeof (NvDsVehicleObject);
// Set the sensor/source ID
meta->sensorId = stream_id;
// Set the frame ID
// Being Recieved in "id"
meta->frameId = frame_meta->frame_num;
// Set object type to UNKNOWN as we are not using extended message
// Being Recieved in "6th"
// meta->objType = obj_params->class_id;
// Set the object class ID
// meta->objClassId = obj_params->class_id;
// Set the detection confidence
// Being Recieved in "14th"
meta->confidence = obj_params->confidence;
// Set the bounding box information (scaling if necessary)
// Being Recieved in "2nd till 5th"
meta->bbox.left = obj_params->rect_params.left * scaleW;
meta->bbox.top = obj_params->rect_params.top * scaleH;
meta->bbox.width = obj_params->rect_params.width * scaleW;
meta->bbox.height = obj_params->rect_params.height * scaleH;
// Set the tracking ID
// Being Recieved in "1st"
meta->trackingId = obj_params->object_id;
meta->moduleId = 1;
meta->placeId = 1;
meta->componentId = 1;
// No need to set timestamps or extended message
meta->ts = NULL;
// meta->extMsg = NULL;
// meta->extMsgSize = 0;
}
The Odd placement of values is by choice so that I recieve all of them.
I have also made sure that all the memory used up is also being freed in the meta_free_func
function.
Is there any way I can send the count information [line-crossing-stream-0]
using the existinting schema?
I need the count of all objects per frame to be apart of the kafka message.
Thank you for your help