When using nvinfer in a GStreamer pipeline, it’s sometimes necessary to allow toggling inference (on/off) at runtime, there are probably a few options:
Dynamically attaching and detaching pipeline pads to remove nvinfer, doesn’t sound like a good idea since it can lead to frames dropping at they flow through the pipeline, so it won’t just turn inference on/off.
Using a tee element along with a valve and/or input-selector, probably “safer” than the first option, but still messes with the pipeline and flowing frames.
Somehow change something in nvinfer at runtime such as a gst property or metadata, which will cause nvinfer to stop processing frames (and just act as a minimal dummy element). This will be ideal since the pipeline will stay intact while allowing any inference processing to totally stop.
I’ve successfully caused nvinfer to disable by setting the “interval” GST property to G_MAXINT.
Can you please advise regarding the nvtracker element (which follows the above nvinfer), the problem is that after nvinfer is “disabled” - the tracker keeps tracking previously detected objects, is there a way to “reset” the state of nvtracker so it stops tracking any existing objects until new ones arrive?
there will no bbox if nvinfer’s interval is G_MAXINT, nvtracker 's workflow is based on bboxes, so nvtracker can’t work if no bboxes.
why do you want to stop all calculations? for performance?
When nvinfer’s interval is 25 for example - everything works well, it is detecting and nvtracker is tracking the provided objects.
When I “turn off” inference by setting nvinfer’s interval to G_MAXINT - indeed no more metadata is being downstreamed by nvinfer, but nvtracker is still tracking previously provided objects, so I’m looking for a way to force nvtracker to reset state and stop any active tracking immediately.
My general quest is after a way to “turn off” inference (nvinfer ! nvtracker) at runtime.
I haven’t change anything in code, and I’m using config_tracker_NvDCF_perf.yaml which comes with DP 6.1 samples.
But how is this relevant? nvtracker’s mission is to track objects continuously as long as age or quality thresholds aren’t met. nvinfer’s interval can be 50 (two seconds for 25 fps video) and nvtracker will keep tracking objects independently.
I’m just looking for a way to “disable” inference at runtime. One possibility is to “stop” nvinfer by setting it’s interval to a very big number and somehow reset nvtracker’s state so all existing tracked objects disappear.
I will be very grateful if you can ask your engineers how they see the requirement to seamlessly toggle inference (enable/disable) at runtime without stopping the pipeline.
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
nvtracker dose not support to modify parameters dynamically. there is a workaround:
remove object meta after nvtracker, then nvosd will draw nothing on the frame. please refer to this topic: Cannot remove obj from frame meta