Suppose that you are familiar with gstreamer plugin development. If not, you need to study how to develop gstreamer plugin first. https://gstreamer.freedesktop.org/
I don’t think the detection can be implemented with modifying one or two functions in nvinfer. You need to understand the nvinfer work flow before you modify it.
There is nvinfer source codes graph here. DeepStream SDK FAQ