clarified-moonstone

This commit is contained in:
firestar5683
2026-07-20 15:34:14 -05:00
parent f2b14c7ac0
commit 43143e7a1f
4 changed files with 13 additions and 4 deletions
+3 -3
View File
@@ -157,8 +157,8 @@ SPEED_LIMIT_CLASSES = {
13: 90,
}
VALID_SPEED_LIMITS_MPH = set(range(10, 125, 5))
MIN_PUBLISHABLE_SPEED_LIMIT_MPH = 20
VALID_SPEED_LIMITS_MPH = set(range(5, 125, 5))
MIN_PUBLISHABLE_SPEED_LIMIT_MPH = 5
LEGACY_MODEL_PATH = Path(__file__).resolve().parents[1] / "assets" / "vision_models" / "speed_limit_vision.onnx"
US_DETECTOR_MODEL_PATH = Path(__file__).resolve().parents[1] / "assets" / "vision_models" / "speed_limit_us_detector.onnx"
US_CLASSIFIER_MODEL_PATH = Path(__file__).resolve().parents[1] / "assets" / "vision_models" / "speed_limit_us_value_classifier.onnx"
@@ -168,7 +168,7 @@ US_DETECTOR_CLASSES = {
1: "advisory_speed_limit",
2: "school_zone_speed_limit",
}
US_CLASSIFIER_SPEED_VALUES = (15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75)
US_CLASSIFIER_SPEED_VALUES = (10, 100, 15, 20, 25, 30, 35, 40, 45, 5, 50, 55, 60, 65, 70, 75, 80, 90)
EXTENDED_CLASSIFIER_SPEED_VALUES = frozenset((5, 10, 80, 90, 100))
SCHOOL_ZONE_SPEED_VALUES = frozenset((15, 20, 25))
US_DETECTOR_MIN_CONFIDENCE = 0.06
@@ -78,7 +78,7 @@ def test_published_sign_value_uses_configured_units():
@pytest.mark.parametrize(("confidence", "expected"), ((0.89, None), (0.91, (80, 0.91))))
def test_extended_classifier_values_require_high_confidence(monkeypatch, confidence, expected):
speed_values = (10, 100, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 90)
speed_values = (10, 100, 15, 20, 25, 30, 35, 40, 45, 5, 50, 55, 60, 65, 70, 75, 80, 90)
probabilities = np.zeros(len(speed_values) + 1, dtype=np.float32)
probabilities[speed_values.index(80)] = confidence
probabilities[-1] = 1.0 - confidence
@@ -102,6 +102,15 @@ def test_extended_classifier_values_require_high_confidence(monkeypatch, confide
assert result == pytest.approx(expected)
def test_five_mph_detection_is_publishable():
daemon = SpeedLimitVisionDaemon.__new__(SpeedLimitVisionDaemon)
detection = daemon._publishable_detection(slv.Detection(5, 0.95))
assert detection is not None
assert detection.speed_limit_mph == 5
def test_speed_change_requires_two_matching_reads_below_single_read_threshold():
daemon = daemon_with_history(40, [(55, 0.82)])
assert daemon._confirm_detection() is None
BIN
View File
Binary file not shown.