feat(research): preserve urban geometry pipelines and qualification suites

Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:10:00 +03:00
parent 5d56237124
commit 69dc566665
611 changed files with 52016 additions and 28 deletions
@@ -0,0 +1,69 @@
import unittest
import numpy as np
from mv_math import voxel_stations, station_views, group_matrix, visibility_weight, station_average, surface_scores
class MultiviewTests(unittest.TestCase):
def test_dwell_and_order_do_not_change_stations(self):
p = np.c_[np.arange(50) * .6, np.sin(np.arange(50)), np.ones(50) * 1.4]
expected = voxel_stations(p)
actual = voxel_stations(np.concatenate([p[::-1], np.repeat(p[10:11], 1000, axis=0)]))
np.testing.assert_array_equal(expected, actual)
self.assertTrue(all(np.any(np.all(p == x, axis=1)) for x in actual))
def test_invalid_poses_fail(self):
with self.assertRaises(ValueError):
voxel_stations([[0, 1, np.nan]])
def test_four_views_use_actual_pose_height(self):
stations = np.array([[0., 0, 1.4], [8, 0, 1.6], [16, 0, 1.8]])
views = station_views(stations, stations[:, 2] - 1.4)
self.assertEqual(len(views), 3)
for st, eye in zip(views, stations):
self.assertEqual(len(st['views']), 4)
for v in st['views']:
np.testing.assert_array_equal(v['eye'], eye)
self.assertLess(v['target'][2], eye[2])
def test_every_model_class_preserved_once(self):
for model, count in [('mapillary', 65), ('cityscapes', 19)]:
m = group_matrix(model, count)
np.testing.assert_array_equal(m.sum(0), np.ones(count))
def test_duplicate_headings_do_not_inflate_weight(self):
p = np.array([[[.55], [.35], [.1], [0], [0], [0]]], np.float32)
a, w = station_average(p, np.array([[.7]]))
b, v = station_average(np.repeat(p, 10, axis=0), np.full((10, 1), .7))
np.testing.assert_allclose(a, b, atol=1e-6)
np.testing.assert_allclose(w, v)
def test_losing_class_is_retained_until_fusion(self):
p = np.array([[[.51], [.49], [0], [0], [0], [0]], [[.01], [.99], [0], [0], [0], [0]]])
fused, _ = station_average(p, np.ones((2, 1)))
self.assertAlmostEqual(float(fused[1, 0]), .74, places=6)
self.assertGreater(fused[1, 0], fused[0, 0])
def test_foreground_occluder_is_not_ground_observation(self):
w = visibility_weight(np.array([10., 10., 10.]), np.array([10., 7., np.nan]),
np.ones(3), np.ones(3) * 10, np.ones(3, bool))
self.assertGreater(w[0], 0)
self.assertEqual(w[1], 0)
self.assertEqual(w[2], 0)
def test_soft_depth_residual_is_not_immediate_hole(self):
w = visibility_weight(np.array([10., 10.]), np.array([10., 10.3]), np.ones(2),
np.ones(2) * 10, np.ones(2, bool))
self.assertGreater(w[1], 0)
self.assertLess(w[1], w[0])
def test_unknown_and_vehicle_do_not_become_sidewalk(self):
p = np.array([[.2, .7, 0], [.2, .1, 0], [.6, .1, 0], [0, .1, 0], [0, 0, 0], [0, 0, 0]])
road, side = surface_scores(p, np.array([1., 1, 0]))
self.assertEqual(road[0], 0)
self.assertEqual(side[0], 0)
self.assertEqual(road[2], 0)
self.assertAlmostEqual(road[1], .7)
if __name__ == '__main__':
unittest.main()