Adding analytics to Custom schema payload

Please provide the following information when requesting support.

•We have our custom trained model, where there was a requirement to calculate the entry /exit count . We have added this functionality to deep stream test 5 application by integrating it with deepstream-occupancy-analytics (GitHub - NVIDIA-AI-IOT/deepstream-occupancy-analytics: This is a sample application for counting people entering/leaving in a building using NVIDIA Deepstream SDK, Transfer Learning Toolkit (TLT), and pre-trained models. This application can be used to build real-time occupancy analytics applications for smart buildings, hospitals, retail, etc. The application is based on deepstream-test5 sample application.). however we are not able to receive the analytics data via (257) PAYLOAD_CUSTOM - Custom schema payload or (1)PAYLOAD_DEEPSTREAM_MINIMAL - Deepstream schema payload minimal. kindly need your guidance to resolve this issue .
Please let us know the feasibility to add the analytics feature to generate_dsmeta_message_minimal in dsmeta_payload.cpp file

gchar* generate_dsmeta_message_minimal (void *privData, void frameMeta)
{
/

The JSON structure of the frame
{
“version”: “4.0”,
“id”: “frame-id”,
@timestamp”: “2018-04-11T04:59:59.828Z”,
“sensor”: “sensor-id”,
“objects”: [
“…object-1 attributes…”,
“…object-2 attributes…”,
“…object-3 attributes…”
]
}
*/

/*
An example object with Vehicle object-type
{
“version”: “4.0”,
“id”: “frame-id”,
@timestamp”: “2018-04-11T04:59:59.828Z”,
“sensorId”: “sensor-id”,
“objects”: [
“957|1834|150|1918|215|Vehicle|#|sedan|Bugatti|M|blue|CA 444|California|0.8”,
“…”
]
}
*/

JsonNode *rootNode;
JsonObject *jobject;
JsonArray *jArray;
stringstream ss;
gchar *message = NULL;

jArray = json_array_new ();

NvDsFrameMeta *frame_meta = (NvDsFrameMeta *) frameMeta;
for (NvDsObjectMetaList *obj_l = frame_meta->obj_meta_list; obj_l; obj_l = obj_l->next) {
NvDsObjectMeta *obj_meta = (NvDsObjectMeta *) obj_l->data;
if (obj_meta == NULL) {
// Ignore Null object.
continue;
}

// bbox sub object
float scaleW = (float) frame_meta->source_frame_width /
                    (frame_meta->pipeline_width == 0) ? 1:frame_meta->pipeline_width;
float scaleH = (float) frame_meta->source_frame_height /
                    (frame_meta->pipeline_height == 0) ? 1:frame_meta->pipeline_height;

float left   = obj_meta->rect_params.left   * scaleW;
float top    = obj_meta->rect_params.top    * scaleH;
float width  = obj_meta->rect_params.width  * scaleW;
float height = obj_meta->rect_params.height * scaleH;

ss.str("");
ss.clear();
ss << obj_meta->object_id << "|" << left << "|" << top
   << "|" << left + width << "|" << top + height
   << "|" << obj_meta->obj_label;

if(g_list_length(obj_meta->classifier_meta_list) > 0) {
    ss << "|#";
    //Add classifiers for the object, if any
    for(NvDsClassifierMetaList *cl = obj_meta->classifier_meta_list; cl ; cl=cl->next) {
      NvDsClassifierMeta *cl_meta = (NvDsClassifierMeta*) cl->data;
      for(NvDsLabelInfoList *ll = cl_meta->label_info_list; ll ; ll=ll->next) {
        NvDsLabelInfo *ll_meta = (NvDsLabelInfo*) ll->data;
        ss<< "|" << ll_meta->result_label;
      }
    }
    ss << "|" << obj_meta->confidence;
}
json_array_add_string_element (jArray, ss.str().c_str());

}

//generate timestamp
char ts[MAX_TIME_STAMP_LEN + 1];
generate_ts_rfc3339 (ts, MAX_TIME_STAMP_LEN);

//fetch sensor id
string sensorId=“0”;
NvDsPayloadPriv *privObj = (NvDsPayloadPriv *) privData;
auto idMap = privObj->sensorObj.find (frame_meta->source_id);
if (idMap != privObj->sensorObj.end()) {
NvDsSensorObject &obj = privObj->sensorObj[frame_meta->source_id];
sensorId = obj.id;
}

jobject = json_object_new ();
json_object_set_string_member (jobject, “version”, “4.0”);
json_object_set_string_member (jobject, “id”, to_string(frame_meta->frame_num).c_str());
json_object_set_string_member (jobject, “@timestamp”, ts);
json_object_set_string_member (jobject, “sensorId”, sensorId.c_str());

json_object_set_array_member (jobject, “objects”, jArray);

JsonArray *custMsgjArray = json_array_new ();
//Search for any custom message blob within frame usermeta list
for (NvDsUserMetaList *l = frame_meta->frame_user_meta_list; l; l = l->next) {
NvDsUserMeta *frame_usermeta = (NvDsUserMeta *) l->data;
if(frame_usermeta && frame_usermeta->base_meta.meta_type == NVDS_CUSTOM_MSG_BLOB) {
NvDsCustomMsgInfo *custom_blob = (NvDsCustomMsgInfo *) frame_usermeta->user_meta_data;
string msg = string((const char *) custom_blob->message, custom_blob->size);
json_array_add_string_element (custMsgjArray, msg.c_str());
}
}
if(json_array_get_length(custMsgjArray) > 0)
json_object_set_array_member (jobject, “customMessage”, custMsgjArray);
else
json_array_unref(custMsgjArray);

rootNode = json_node_new (JSON_NODE_OBJECT);
json_node_set_object (rootNode, jobject);

message = json_to_string (rootNode, TRUE);
json_node_free (rootNode);
json_object_unref (jobject);

return message;
}

Hi,
Seems that is it is a topic of deepstream. Changing it to Deepstream forum.

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)

• DeepStream Version

• JetPack Version (valid for Jetson only)

• TensorRT Version

• NVIDIA GPU Driver Version (valid for GPU only)

• Issue Type( questions, new requirements, bugs)

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

please refer to this topic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.