Adding new variables to NvDsVehicleObject Struct Reference

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)
Add a new variable to NvDsVehicleObject.

  • A new variable ImagePath was updated to this header file and compile it with deepstream_python_apps for .whl file to install for python.
  • Futhermore, I have updated the new variable in eventmsg_payload.cpp to push the json format to kafka
  • There’s no error after I run the code with new variable added in, but the json was not updated to kafka. I have tried to change either of the name of the object is not updated as well.
  • Is there any method could update the code for the my application?
    • 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)
NvDsVehicleObjectExt *dsObj = (NvDsVehicleObjectExt *)meta->extMsg;
      if (dsObj)
        json_object_set_string_member(jobject, "type", dsObj->imagePath);
        json_object_set_string_member(jobject, "make", dsObj->make);
        json_object_set_string_member(jobject, "model", dsObj->model);
        json_object_set_string_member(jobject, "color", dsObj->color);
        json_object_set_string_member(jobject, "licenseState", dsObj->region);
        json_object_set_string_member(jobject, "license", dsObj->license);
        json_object_set_string_member(jobject, "imagePath", dsObj->imagePath);
        json_object_set_double_member(jobject, "confidence", meta->confidence);

        objectMask = dsObj->mask;

This is the json output in kafka

    "messageid": "9ecced89-d1f9-424b-aa5b-eb999bdaba07",
    "mdsversion": "1.0",
    "@timestamp": "2024-05-09T08:01:07.635Z",
    "place": {
        "id": "1",
        "name": "XYZ",
        "type": "garage",
        "location": {"lat": 35.32, "lon": -40.55, "alt": 100.0},
        "aisle": {
            "id": "walsh",
            "name": "lane1",
            "level": "P2",
            "coordinate": {"x": 1.0, "y": 2.0, "z": 3.0},
    "sensor": {
        "id": "1",
        "type": "Camera",
        "description": '"JALAN AWAN BESAR"',
        "location": {"lat": 45.293701447, "lon": -75.8303914499, "alt": 48.1557479338},
        "coordinate": {"x": 5.2, "y": 10.1, "z": 11.2},
    "analyticsModule": {
        "id": "XYZ",
        "description": '"Vehicle Detection and License Plate Recognition"',
        "source": "OpenALR",
        "version": "1.0",
    "object": {
        "id": "8",
        "speed": 0.0,
        "direction": 0.0,
        "orientation": 0.0,
        "vehicle": {
            "type": "Vehicle",
            "make": "Bugatti",
            "model": "M",
            "color": "blue",
            "licenseState": "CA",
            "license": "VCQ8701",
            "confidence": 0.0,
        "bbox": {
            "topleftx": 243,
            "toplefty": 358,
            "bottomrightx": 474,
            "bottomrighty": 635,
        "location": {"lat": 0.0, "lon": 0.0, "alt": 0.0},
        "coordinate": {"x": 0.0, "y": 0.0, "z": 0.0},
        "pose": {},
    "event": {"id": "e96f589b-2c50-47f5-a39c-a4ca81de4809", "type": "moving"},
    "videoPath": "/home/wesenkhoo/Documents/ITMAX/deepstream_ws/test/deepstream_lpr/new_ds/deepstream_lpr/images/VCQ8701.jpg",

Did you use the code snippet of generate_vehicle_meta in ?

Have you added the corresponding python bindings in the pyds.

Generally speaking, you need to modify the following two codes

Forgot to mention that I have changed everything that contains NvDsVehicleObject in the library as well.

py::class_<NvDsVehicleObject>(m, "NvDsVehicleObject",
    .def_property("type", STRING_PROPERTY(NvDsVehicleObject, type))
    .def_property("make", STRING_PROPERTY(NvDsVehicleObject, make))
                    STRING_PROPERTY(NvDsVehicleObject, model))
                    STRING_PROPERTY(NvDsVehicleObject, color))

        [](void *data)
            return (NvDsVehicleObject *)data;

        [](size_t data)
            return (NvDsVehicleObject *)data;

                    STRING_PROPERTY(NvDsVehicleObject, region))
                    STRING_PROPERTY(NvDsVehicleObject, imagePath))
                    STRING_PROPERTY(NvDsVehicleObject, license));
NvDsVehicleObject *obj = (NvDsVehicleObject *)srcData->extMsg;
    if (obj->type)
    if (obj->color)
    if (obj->make)
    if (obj->model)
    if (obj->license)
    if (obj->imagePath)
    if (obj->region)

Since you didn’t provide the code, I don’t know where you went wrong. Use NvDsVehicleObject to replace NvDsVehicleObjectExt

Please refer to the patch below. After my test, it works normally. I use

python3 -i /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream/lib/ --no-display --conn-str="localhost;9092;test"

for deepstream_python_apps

diff --git a/apps/deepstream-test4/ b/apps/deepstream-test4/
index 22675a5..5119055 100755
--- a/apps/deepstream-test4/
+++ b/apps/deepstream-test4/
@@ -61,6 +61,7 @@ def generate_vehicle_meta(data):
     obj.model = "M"
     obj.license = "XX1234"
     obj.region = "CA"
+    obj.imagePath = "test.jpg"
     return obj
@@ -185,7 +186,7 @@ def osd_sink_pad_buffer_probe(pad, info, u_data):
             # Ideally NVDS_EVENT_MSG_META should be attached to buffer by the
             # component implementing detection / recognition logic.
             # Here it demonstrates how to use / attach that meta data.
-            if is_first_object and (frame_number % 30) == 0:
+            if is_first_object and obj_meta.class_id == PGIE_CLASS_ID_VEHICLE and (frame_number % 30) == 0:
                 # Frequency of messages to be send will be based on use case.
                 # Here message is being sent for first object every 30 frames.
diff --git a/bindings/src/bindschema.cpp b/bindings/src/bindschema.cpp
index 7085d3d..1f2858e 100644
--- a/bindings/src/bindschema.cpp
+++ b/bindings/src/bindschema.cpp
@@ -81,6 +81,8 @@ namespace pydeepstream {
                 obj->license = g_strdup (srcObj->license);
                 if (srcObj->region)
                 obj->region = g_strdup (srcObj->region);
+                if (srcObj->imagePath)
+                    obj->imagePath = g_strdup (srcObj->imagePath);
                 destData->extMsg = obj;
                 destData->extMsgSize = sizeof (NvDsVehicleObject);
             } else if (srcData->objType == NVDS_OBJECT_TYPE_PERSON) {
@@ -146,6 +148,8 @@ namespace pydeepstream {
                             g_free (obj->license);
                         if (obj->region)
                             g_free (obj->region);
+                        if (obj->imagePath)
+                            g_free (obj->imagePath);
                     } else if (srcData->objType == NVDS_OBJECT_TYPE_PERSON) {
                         NvDsPersonObject *obj = (NvDsPersonObject *) srcData->extMsg;
                         if (obj->gender)
@@ -353,7 +357,9 @@ namespace pydeepstream {
                               STRING_PROPERTY(NvDsVehicleObject, region))
-                              STRING_PROPERTY(NvDsVehicleObject, license));
+                              STRING_PROPERTY(NvDsVehicleObject, license))
+                .def_property("imagePath",
+                              STRING_PROPERTY(NvDsVehicleObject, imagePath));
               []() {

for nvdsmeta_schema.h and eventmsg_payload.cpp

diff --git a/sources/includes/nvdsmeta_schema.h b/sources/includes/nvdsmeta_schema.h
index 47f86c3..0814b81 100644
--- a/sources/includes/nvdsmeta_schema.h
+++ b/sources/includes/nvdsmeta_schema.h
@@ -156,6 +156,7 @@ typedef struct NvDsVehicleObject {
   gchar *color;     /**< Holds a pointer to the color of the vehicle. */
   gchar *region;    /**< Holds a pointer to the region of the vehicle. */
   gchar *license;   /**< Holds a pointer to the license number of the vehicle.*/
+  gchar *imagePath;
 } NvDsVehicleObject;
diff --git a/sources/libs/nvmsgconv/deepstream_schema/eventmsg_payload.cpp b/sources/libs/nvmsgconv/deepstream_schema/eventmsg_payload.cpp
index d345289..0d97c1c 100644
--- a/sources/libs/nvmsgconv/deepstream_schema/eventmsg_payload.cpp
+++ b/sources/libs/nvmsgconv/deepstream_schema/eventmsg_payload.cpp
@@ -402,6 +402,7 @@ generate_object_object (void *privData, NvDsEventMsgMeta *meta)
           json_object_set_string_member (jobject, "color", dsObj->color);
           json_object_set_string_member (jobject, "licenseState", dsObj->region);
           json_object_set_string_member (jobject, "license", dsObj->license);
+          json_object_set_string_member (jobject, "imagePath", dsObj->imagePath);
           json_object_set_double_member (jobject, "confidence", meta->confidence);
       } else {
@@ -412,6 +413,7 @@ generate_object_object (void *privData, NvDsEventMsgMeta *meta)
         json_object_set_string_member (jobject, "color", "");
         json_object_set_string_member (jobject, "licenseState", "");
         json_object_set_string_member (jobject, "license", "");
+        json_object_set_string_member (jobject, "imagePath", "");
         json_object_set_double_member (jobject, "confidence", 1.0);
       json_object_set_object_member (objectObj, "vehicle", jobject);

Here is my result

"vehicle" : {
      "type" : "sedan",
      "make" : "Bugatti",
      "model" : "M",
      "color" : "blue",
      "licenseState" : "CA",
      "license" : "XX1234",
      "imagePath" : "test.jpg",
      "confidence" : 0.20320838689804077

Mornin junshengy, I have done the exact same step as you shown before but I gave it a new try. Unfortunately, I couldn’t get the result as well. When I change the string name for instance, “licenseState” to a new variable the result isn’t updated to result as well. Therefore, I assumed that my code wasn’t update but the bindschema.cpp. Is there any ways to update deepstream eventpayload code?

If the installation is correct and confirm that the above patch has been applied, try the following steps.

1.reinstall nvmsgconv

cd /opt/nvidia/deepstream/deepstream/sources/libs/nvmsgconv

make CUDA_VER=12.2 clean  

make CUDA_VER=12.2 install
  1. reinstall pyds:
cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/bindings/build


pip uninstall pyds

pip install ./pyds-1.1.11-py3-none-linux_x86_64.whl # I'm using DeepStream7.0 and I think DS-6.4 is the same app with kafka.

cd /opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test4

python3 -i /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream/lib/ --no-display --conn-str="localhost;9092;test"

If it still doesn’t work correctly, please check your code

msgconv.set_property('config', MSCONV_CONFIG_FILE)
AttributeError: 'NoneType' object has no attribute 'set_property'

Did you face any error about the msgconv after I rebuild the lib?

No, this problem has nothing to do with nvmsgconv.

It is caused by the related dependencies of pyds not being installed correctly.

(python3:23238): GStreamer-WARNING **: 11:00:57.224: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/': ///opt/nvidia/deepstream/deepstream-6.4/lib/ undefined symbol: _ZN4YAML6detail9node_data12empty_scalarB5cxx11E

but it shows an error about it

Please follow the README in the /opt/nvidia/deepstream/deepstream/sources/libs/nvmsgconv

sudo apt-get install libglib2.0-dev libjson-glib-dev uuid-dev libyaml-cpp-dev protobuf-compiler
(python3:26188): GStreamer-CRITICAL **: 11:25:19.259: gst_element_factory_create_valist: assertion 'newfactory != NULL' failed
 Unable to create msgconv 

This happened after I rebuild the .so library

msgconv = Gst.ElementFactory.make("nvmsgconv", "nvmsg-converter")
    if not msgconv:
        sys.stderr.write(" Unable to create msgconv \n")

This error was shown while creating the msgconv

BTW, the packages was installed

Due to lack of dependencies before, nvmsgconv is in gstreamer’s blacklist.

gst-inspect-1.0 -b can view the blacklist of plugins


sudo /opt/nvidia/deepstream/deepstream/

It is recommended that you use docker to avoid various dependency issues

Blacklisted files:

Total count: 6 blacklisted files

I could see there’s 6 blacklisted file. Also,I have run but I receive the same issue as well

Check what dependencies you are missing

 ldd /opt/nvidia/deepstream/deepstream/lib/
ldd /opt/nvidia/deepstream/deepstream-6.4/lib/ (0x00007ffe49ff8000) => /lib/x86_64-linux-gnu/ (0x00007f9414709000) => /lib/x86_64-linux-gnu/ (0x00007f94145cf000) => /lib/x86_64-linux-gnu/ (0x00007f94145c6000) => /lib/x86_64-linux-gnu/ (0x00007f9414587000) => /lib/x86_64-linux-gnu/ (0x00007f9414200000) => /lib/x86_64-linux-gnu/ (0x00007f9413e00000) => /lib/x86_64-linux-gnu/ (0x00007f9414565000) => /lib/x86_64-linux-gnu/ (0x00007f9413a00000) => /lib/x86_64-linux-gnu/ (0x00007f9413826000) => /lib/x86_64-linux-gnu/ (0x00007f9414505000) => /lib/x86_64-linux-gnu/ (0x00007f941418a000) => /lib/x86_64-linux-gnu/ (0x00007f94140a3000)
	/lib64/ (0x00007f94148ba000) => /lib/x86_64-linux-gnu/ (0x00007f94144e7000) => /lib/x86_64-linux-gnu/ (0x00007f94144e0000) => /lib/x86_64-linux-gnu/ (0x00007f941405f000) => /lib/x86_64-linux-gnu/ (0x00007f9414033000) => /lib/x86_64-linux-gnu/ (0x00007f94144d1000) => /lib/x86_64-linux-gnu/ (0x00007f9413dc9000) => /lib/x86_64-linux-gnu/ (0x00007f9413d32000)

Check this plugin to find missing libraries.

ldd /opt/nvidia/deepstream/deepstream/lib/gst-plugins/
ldd /opt/nvidia/deepstream/deepstream/lib/gst-plugins/ (0x00007fff5eee7000) => ///opt/nvidia/deepstream/deepstream-6.4/lib/ (0x000077f8fe9a2000) => ///opt/nvidia/deepstream/deepstream-6.4/lib/ (0x000077f8fe99b000) => ///opt/nvidia/deepstream/deepstream-6.4/lib/ (0x000077f8fe98d000) => ///opt/nvidia/deepstream/deepstream-6.4/lib/ (0x000077f8fe831000) => /lib/x86_64-linux-gnu/ (0x000077f8fe6b8000) => /lib/x86_64-linux-gnu/ (0x000077f8fe633000) => /lib/x86_64-linux-gnu/ (0x000077f8fe4f9000) => /lib/x86_64-linux-gnu/ (0x000077f8fe499000) => /lib/x86_64-linux-gnu/ (0x000077f8fe200000) => /lib/x86_64-linux-gnu/ (0x000077f8fe479000) => /lib/x86_64-linux-gnu/ (0x000077f8fde00000) => ///opt/nvidia/deepstream/deepstream-6.4/lib/ (0x000077f8fe46d000) => /lib/x86_64-linux-gnu/ (0x000077f8fe457000) => /lib/x86_64-linux-gnu/ (0x000077f8fe1d3000) => /lib/x86_64-linux-gnu/ (0x000077f8fe44e000) => /lib/x86_64-linux-gnu/ (0x000077f8fe194000) => /lib/x86_64-linux-gnu/ (0x000077f8fda00000) => /lib/x86_64-linux-gnu/ (0x000077f8fe445000) => /lib/x86_64-linux-gnu/ (0x000077f8fe0ad000) => /lib/x86_64-linux-gnu/ (0x000077f8fe092000) => /lib/x86_64-linux-gnu/ (0x000077f8fdd54000) => /lib/x86_64-linux-gnu/ (0x000077f8fdcde000) => /lib/x86_64-linux-gnu/ (0x000077f8fe436000)
        /lib64/ (0x000077f8fe9b9000) => /lib/x86_64-linux-gnu/ (0x000077f8fe061000) => /lib/x86_64-linux-gnu/ (0x000077f8fd826000) => /lib/x86_64-linux-gnu/ (0x000077f8fe045000) => /lib/x86_64-linux-gnu/ (0x000077f8fd7fb000) => /lib/x86_64-linux-gnu/ (0x000077f8fd7dd000) => /lib/x86_64-linux-gnu/ (0x000077f8fe032000) => /lib/x86_64-linux-gnu/ (0x000077f8fd799000) => /lib/x86_64-linux-gnu/ (0x000077f8fd76d000) => /lib/x86_64-linux-gnu/ (0x000077f8fd736000) => /lib/x86_64-linux-gnu/ (0x000077f8fd69f000)

What is the output of the following command line ?

rm -rf ~/.cache/gstreamer-1.0/registry.x86_64.bin 

gst-inspect-1.0 nvmsgconv 

gst-inspect-1.0 nvmsgconv
No such element or plugin ‘nvmsgconv’