src.tests.directional_reclassifier_test

Classes

DirectionalReclassifierTest()

class src.tests.directional_reclassifier_test.DirectionalReclassifierTest
Author:

Alberto M. Esmoris Pena

Directional reclassifier test that checks the overhang/underhang relabeling on a synthetic ground+wall scene with analytical ground truth.

The synthetic point cloud has four disjoint groups:

  1. Ground plane (\(z = 0\)), class index 0.

  2. Wall plane (\(y = 0\)), class index 1.

  3. Overhang rim (\(y = +0.20\), near the top of the wall), class index 1 (still labeled as wall).

  4. Underhang rim (\(y = -0.20\), near the top of the wall), class index 1 (still labeled as wall).

The reclassifier is configured so wall points become wall_overhang if their projection on the forward direction \(+y\) exceeds \(+\epsilon\) and wall_underhang if their projection is below \(-\epsilon\). The test asserts:

  • All ground points keep their class.

  • All core wall points (at \(y = 0\)) keep their class.

  • All overhang-rim points become wall_overhang.

  • All underhang-rim points become wall_underhang.

A second sub-scenario also covers the C \ P invariant: a handful of wall points are filtered out of \(P\) by the conditions (here, by attaching a feature flag and using a feature-based conditions filter); those points must be left unchanged regardless of geometry.

__init__()

Basic configuration for any VL3D test.

Parameters:

name (str) – Test name

run()

Run the directional reclassifier test.

Returns:

True when the synthetic ground truth is recovered exactly, False otherwise.

Return type:

bool

SYNTH_DIR = 'test_data/synthetic_overhang'
SYNTH_GRID_SEP = 100.0
LINEAR_BASELINE = {'F1': 97.45, 'OA': 99.972, 'P': 98.123, 'R': 96.795, 'mAcc': 96.795, 'overhang': {'F1': 94.914, 'P': 96.265, 'R': 93.6}, 'wall': {'F1': 99.986, 'P': 99.982, 'R': 99.99}}
POLYNOMIAL_BASELINE = {'F1': 60.167, 'OA': 98.408, 'P': 56.113, 'R': 86.817, 'mAcc': 86.817, 'overhang': {'F1': 21.138, 'P': 12.298, 'R': 75.159}, 'wall': {'F1': 99.196, 'P': 99.928, 'R': 98.474}}
KPI_EPS = 0.01
DR_RECL_KWARGS = {'conditions': None, 'eigenmin_as_feature': True, 'eigenthreshold': 0.3, 'forward_direction': [0, 0, 1], 'init_radius': 5.0, 'min_distance': 0.1, 'reclassification_cluster_as_feature': True, 'reclassification_cluster_radius_as_feature': True, 'source_classes': ['wall', 'overhang'], 'source_is_prediction': False, 'step_radius': 1.0, 'target_overhang_class': 'overhang', 'target_underhang_class': 'overhang', 'variety_distance_as_feature': True, 'variety_distance_tolerance': 0.2}
DR_POLYNOMIAL_OVERRIDES = {'degree': 5, 'trim_factor': 1.0, 'trimmed_refit': True}
linear_subtest()

Mimic synthetic_overhang_evaluation.json: the 224 deg-1 (planar) synthetic clouds, concatenated on a 16x14 grid with 100 m spacing, fed through the DR with default degree = 1, then evaluated via ClassificationEvaluator on {wall, overhang}. Asserts that OA, mAcc (= macro R), P, R, F1 — both globally and class-wise — are at least as good as the corresponding production baseline within the KPI_EPS decimal tolerance.

Returns:

True on pass, False otherwise.

Return type:

bool

polynomial_subtest()

Run the 1120 deg-1..deg-5 synthetic clouds (the synthetic_overhang_evaluation_full.json fixture) through the DR with the production quintic + trimmed-refit overrides (degree = 5, trimmed_refit = True, trim_factor = 1.0). Asserts OA / mAcc / P / R / F1 (global + class-wise) at least as good as the deg=5 trim_on production baseline within KPI_EPS decimal tolerance.

Returns:

True on pass, False otherwise.

Return type:

bool