YOLOv4: Performance is lower when nvinfer interval is 2 and NOT including postprocessing elements

After profiling with Nsight Systems, I found that the issue was due to nvv4l2decoder blocking on gst_v4l2_buffer_pool_acquire_buffer, waiting for available GstBuffers to return from the buffer pool.

I have come up with 2 solutions:

  1. According to this post, set enable-last-sample property of fakesink to false.
gst-launch-1.0 -v \
    filesrc location=town_centre.mp4 ! qtdemux ! h264parse ! nvv4l2decoder num-extra-surfaces=24 ! m.sink_0 \
    nvstreammux name=m batch-size=1 width=1920 height=1080 \
    ! nvinfer config-file-path=config_infer_primary_yoloV4.txt interval=2 \
    ! fakesink sync=false enable-last-sample=false

Processed 7500 frames in 40s (~187.5fps).

  1. Increase buffer-pool-size of nvstreammux (default is 4).
gst-launch-1.0 -v \
    filesrc location=town_centre.mp4 ! qtdemux ! h264parse ! nvv4l2decoder num-extra-surfaces=24 ! m.sink_0 \
    nvstreammux name=m batch-size=1 width=1920 height=1080 buffer-pool-size=5 \
    ! nvinfer config-file-path=config_infer_primary_yoloV4.txt interval=2 \
    ! fpsdisplaysink video-sink=fakesink text-overlay=false sync=false

Result is also ~187.5fps.