How to extract only specific class on deepstream with triton inference server

Currently not supported,

nvinferserver is open source, you can add this feature by yourself, you can refer to this patch.

diff --git a/sources/gst-plugins/gst-nvinferserver/gstnvinferserver_meta_utils.cpp b/sources/gst-plugins/gst-nvinferserver/gstnvinferserver_meta_utils.cpp
index d13a005..39c7336 100755
--- a/sources/gst-plugins/gst-nvinferserver/gstnvinferserver_meta_utils.cpp
+++ b/sources/gst-plugins/gst-nvinferserver/gstnvinferserver_meta_utils.cpp
@@ -105,6 +105,11 @@ attachDetectionMetadata(
             }
         }
 
+        const auto& ids = config.output_control().filter_out_class_ids();
+        if (!ids.empty() &&
+            (std::find(ids.begin(), ids.end(), obj.classIndex) != ids.end()))
+            continue;
+
         /* Scale the bounding boxes proportionally based on how the object/frame
          * was scaled during input. */
         obj.left = (obj.left - offsetLeft) / scaleX + roiLeft;
diff --git a/sources/gst-plugins/gst-nvinferserver/nvdsinferserver_plugin.proto b/sources/gst-plugins/gst-nvinferserver/nvdsinferserver_plugin.proto
index 3d39caf..3843ec8 100755
--- a/sources/gst-plugins/gst-nvinferserver/nvdsinferserver_plugin.proto
+++ b/sources/gst-plugins/gst-nvinferserver/nvdsinferserver_plugin.proto
@@ -124,6 +124,8 @@ message PluginControl {
       /* Classifier type of a particular nvinferserver component. */
       string classifier_type = 3;
     }
+    /* Filter specified class IDs */
+    repeated int32 filter_out_class_ids = 4;
   }
# /opt/nvidia/deepstream/deepstream/sources/includes/nvdsinferserver_plugin.proto also needs to be modified
make CUDA_VER=12.6 install 

Finally, add this to your application configuration file

output_control {
  filter_out_class_ids: [1, 2, 3]
}

Add to FAQ

1 Like