Skip to content

[feat] Improve clustering for motion detector

Tong Fu requested to merge feat/ImproveClusteringForMotionDetector into master

Goal

The goal of this MR is to improve the run time of the motion detector to ensure a real time usage (100ms/frame). Previously, copy lidar information such as "intensity", "distance_m" took a lot of time. In addition, if there are some objects near to the lidar, the points are dense.

Change

To improve runtime:

  • The process to filter outliers of motion point is done in the function of EstimateMotion.
  • If subsampling is required, the motion points near to lidar (controled by SubsampleRange) are subsampled.

Clustering and tracking:

  • A Gaussian Mixture model based clustering method is added, it can do a simple tracking job.
    • A new vtk internal class is created for this gmm model, which is a little bit different from gmm for motion estimation.

Comprison runtime

livox-hap Before After
estimation motion 40ms 45ms
extract cluster with euclidean 49ms 3.0ms
extract cluster with GMM - 0.57ms

Previously, motion detector contains 2 steps: estimation motion and cluster extraction with euclidean distance. The total average execution time is 89ms. Some frames take 100 - 200ms for cluster extraction.

With the improvement of this MR, there are two choices for clustering: the old one (clustering with euclidean) and a new one, clustering with GMM which can also do a first tracking. The total average runtime with clustering euclidean is 48ms, The total average runtime with clustering GMM is 45.57ms.

The cluster extraction has gained 16 times (with old method), 85 times with GMM clustering method.

Result

DEMO TODO

parameters used for this demo:

Screenshot_from_2024-06-23_18-18-02

ToDo

  • To debug: When I apply motion detector filter and play pcap with x1, the NbProcessedFrames (which is log info of motion detector) is greater than the number of frame played. (FYI @timothee.couble )
  • To improve more runtime, use vtkSMPTools to parallise vtk filter function.
  • To detail the documentation of interface
Edited by Gatien Ferret

Merge request reports