Skip to content

3D detection pipeline filtering #680

@maciejmajek

Description

@maciejmajek

Is your feature request related to a problem? Please describe.
3D detection pipeline need filtering

Image

Describe the solution you'd like

Image

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 request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions