GStreamer Motion Detection Bin Performance

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page



Previous: Performance/Xavier NX Index Next: Troubleshooting







This section provides performance measurements for the rrmotiondetectionbin operating in various configurations. The following list describes different aspects of performance that were measured during the evaluation:

  • CPU utilization: This refers to the average percentage of CPU resources used by the pipeline.
  • RAM utilization: This refers to the average percentage of RAM used by the pipeline.
  • GPU utilization: This refers to the average percentage of GPU resources used by the pipeline.

To measure these metrics, the PID status report was used for CPU and RAM usage, and the following command was used on the Thor AGX to measure GPU usage.

nvidia-smi --query-gpu=timestamp,utilization.gpu,utilization.memory --format=csv -lms 1



Algorithms Configurations

The table below show the results of testing different motion detection algorithms, blob detection method and changing the processing format.

  • The motion detection algorithm was changed with the property motion_detector::motion and can take 2 values 'mog' or 'mog2'

The remaining configurations use default values: a noise reduction kernel size of 9, CPU-based blob detection (cuda-blob-detection set to false), grayscale enabled, and a sample frequency of 1.

Results

The measurements in this subsection were obtained from the following pipeline using a 4K input file and downscale to HD:

The rrmotiondetectionbin configuration were changed to determine its performance with different settings, changed with the corresponding element's properties.

Resolution Motion Detection Algorithm CPU(*) RAM GPU
4K mog 1.71% 1.94% 12.70%
mog2 1.90% 1.92% 6.64%
HD mog 1.68% 1.67% 4.32%
mog2 1.56% 1.68% 2.50%

(*) CPU usage is an average across all CPU cores. 100% would mean all cores are fully used.

Denoiser Kernel Size

To further analyze the impact of the denoiser we measured the performance for different kernel sizes, keeping the rest of configurations fixated as follows:

  • Motion detection algorithm: MOG
  • Blob detection: CPU
  • Sample Frequency: 1
  • Processing format: grayscale

Results

The measurements in this subsection were obtained from the following pipeline using a 4K input file and downscale to HD:

Resolution Denoiser Kernel Size CPU(*) RAM GPU
4K 5 1.94% 2.07% 13.07%
9 1.93% 2.07% 13.16%
11 1.93% 2.07% 13.15%
HD 5 1.73% 1.68% 4.13%
9 1.69% 1.67% 4.23%
11 1.83% 1.68% 4.25%

(*) CPU usage is an average across all CPU cores. 100% would mean all cores are fully used.

Motion Sampling Frequency

This subsections shows the performance changes caused by different sampling frequencies, keeping the rest of configurations fixated as follows:

  • Motion detection algorithm: MOG
  • Blob detection: CPU
  • Denoise kernel size: 9
  • Processing format: grayscale

Results

The measurements in this subsection were obtained from the following pipeline using a 4K input file and downscale to HD:

Resolution Sample Frequency CPU(*) RAM GPU
4K 1 1.92% 2.07% 13.14%
2 1.25% 1.96% 6.72%
4 1.09% 1.99% 4.04%
HD 1 1.76% 1.67% 4.17%
2 1.29% 1.67% 2.48%
4 1.12% 1.64% 1.59%

(*) CPU usage is an average across all CPU cores. 100% would mean all cores are fully used.

Replicate the results

The following pipelines were used for each section with jetson_clocks.sh enabled.

Algorithms Configurations

gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! queue ! rrmotiondetectionbin motion_detector::motion=$MOTION ! perf ! fakesink sync=true
gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder !  nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080" !  queue ! rrmotiondetectionbin motion_detector::motion=$MOTION ! perf print-cpu-load=true ! fakesink sync=true

Denoiser Kernel Size

gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! queue ! rrmotiondetectionbin motion_detector::motion=mog motion_denoiser::size=$KERNEL_SIZE ! perf print-cpu-load=true  ! fakesink sync=true
gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080" ! queue ! rrmotiondetectionbin cuda-blob-detection=false motion_detector::motion=mog motion_denoiser::size=$KERNEL_SIZE !  perf print-cpu-load=true ! fakesink sync=true

Motion Sampling Frequency

gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080" ! queue ! rrmotiondetectionbin motion_detector::motion=mog motion_denoiser::size=9  motion_detector::sample-frequency=$FREQ !  perf print-cpu-load=true ! fakesink sync=true
gst-launch-1.0 filesrc location=/home/nvidia/street.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! queue ! rrmotiondetectionbin motion_detector::motion=mog motion_detector::sample-frequency=$FREQ motion_denoiser::size=9 ! perf print-cpu-load=true  ! fakesink sync=true
Previous: Performance/Xavier NX Index Next: Troubleshooting