-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
3D detection pipeline need filtering

Describe the solution you'd like

Filtering algo, example below
def _filter_outliers_statistical(points_array: np.ndarray, k: int = 20, std_ratio: float = 2.0) -> np.ndarray:
if points_array.shape[0] == 0:
return points_array
k_eff = min(max(2, k), points_array.shape[0])
nn = NearestNeighbors(n_neighbors=k_eff, algorithm="auto")
nn.fit(points_array)
distances, _ = nn.kneighbors(points_array)
# exclude the zero-distance to self by dropping the first column when possible
if distances.shape[1] > 1:
mean_neighbor_distance = distances[:, 1:].mean(axis=1)
else:
mean_neighbor_distance = distances.mean(axis=1)
threshold = mean_neighbor_distance.mean() + std_ratio * mean_neighbor_distance.std()
inlier_mask = mean_neighbor_distance <= threshold
return points_array[inlier_mask]
Describe alternatives you've considered
None
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request