mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 07:33:46 +08:00
Retain narrow sign reads meeting the original height and area floors
This commit is contained in:
@@ -848,7 +848,11 @@ class VisionModelCore:
|
||||
box_height = y2 - y1
|
||||
if box_width <= 0 or box_height <= 0:
|
||||
continue
|
||||
is_small_box = box_width < DETECTOR_CLASSIFIER_MIN_ACCEPT_WIDTH or box_height < DETECTOR_CLASSIFIER_MIN_ACCEPT_HEIGHT
|
||||
is_small_box = (
|
||||
box_width < DETECTOR_CLASSIFIER_MIN_ACCEPT_WIDTH - 1 or
|
||||
box_height < DETECTOR_CLASSIFIER_MIN_ACCEPT_HEIGHT or
|
||||
box_width * box_height < DETECTOR_CLASSIFIER_MIN_ACCEPT_WIDTH * DETECTOR_CLASSIFIER_MIN_ACCEPT_HEIGHT
|
||||
)
|
||||
# Tiny far-away proposals are the main nighttime false-positive source.
|
||||
# Keep a narrow rescue path for right-side high-confidence reads,
|
||||
# then let temporal confirmation decide whether they are real.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import unittest
|
||||
|
||||
import numpy as np
|
||||
|
||||
from openpilot.starpilot.speed_limits.vision.tests.test_retry_consistency import core_fixture, probabilities
|
||||
|
||||
|
||||
class TestWidthRounding(unittest.TestCase):
|
||||
def test_narrow_plate_needs_original_height_area_and_consistent_reads(self):
|
||||
for width, height, confident in ((27, 43, True), (28, 40, True), (27, 41, False), (26, 44, False), (29, 39, False)):
|
||||
with self.subTest(width=width, height=height):
|
||||
values = [probabilities(30, .992), probabilities(30, .847), probabilities(70, .906)]
|
||||
core = core_fixture([(value, value) for value in values], [False, False, False],
|
||||
proposals=[(.447, 0, (770, 354, 770 + width, 354 + height))])
|
||||
result = core.infer(np.zeros((760, 1344, 3), np.uint8))
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result.speed_limit_mph, 30)
|
||||
self.assertEqual(result.confidence >= .83, confident)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "aa609b4f7ebf67b41995bffbb8dab7edc8c2ef2139bb086d782447aa59cd1dcb", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "1ca3c74ab754614ad521b1c5937dae71b9de81db93571c3545586f804cd401fc", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user