How to add custom variable to NvDsObjectMeta?

**• Hardware Platform (GPU) RTX 3060
**• DeepStream Version 6.0
• TensorRT Version
**• NVIDIA GPU Driver Version (valid for GPU only) CUDA11.7
• Issue Type (questions)

I want to use a probe function to add custom variable to NvDsObjectMeta in the nvdsmeta.h file

typedef struct _NvDsObjectMeta {
NvDsBaseMeta base_meta;
struct _NvDsObjectMeta *parent;
gint unique_component_id;
gint class_id;
guint64 object_id;
NvDsComp_BboxInfo detector_bbox_info;
NvDsComp_BboxInfo tracker_bbox_info;
gfloat confidence;
gfloat tracker_confidence;
NvOSD_RectParams rect_params;
NvOSD_MaskParams mask_params;
NvOSD_TextParams text_params;
gchar obj_label[MAX_LABEL_SIZE];
NvDsClassifierMetaList *classifier_meta_list;
NvDsUserMetaList *obj_user_meta_list;
gint64 misc_obj_info[MAX_USER_FIELDS];
gint64 reserved[MAX_RESERVED_FIELDS];

gfloat Variation; //New Add

}NvDsObjectMeta;

My questions are:
1.I want to add “gfloat Variation” in NvDsObjectMeta,what do i have to do?
2.Why do I add a variable and give it a value, but it cannot be used together on different cpps.

You can use NvDsUserMeta, please refer to the open source demo code:sources\apps\sample_apps\deepstream-user-metadata-test

If I don’t want to customize a structure, can I add variables under the original typedef struct _NvDsObjectMeta?

If I modify the value of confidence under _NvDsObjectMeta, the value received by all cpps will change, but I customize a variable in it, and after giving it a value, other cpps cannot receive the changed value

I found that the length of the _NvDsObjectMeta structure is abnormal after the new variable is added. May I ask where the length part should be modified?

We do not recommend that you modify the existing structure directly. In this way, you need to make a lot of changes, and some of the code is not yet open source. We suggest you use NvDsUserMeta if you want use your own structure.

1 Like

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