This commit is contained in:
firestar5683
2026-07-15 11:32:02 -05:00
parent a6ffaaa781
commit ba460bbb7b
3 changed files with 25 additions and 1 deletions
+1
View File
@@ -10,6 +10,7 @@ source_files = [
for f in Path("generator").rglob("*")
if f.is_file() and f.suffix in {".py", ".dbc"}
]
source_files.append(File("hyundai_kia_generic.dbc"))
output_files = [
f.name.replace(".dbc", "_generated.dbc")
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
from pathlib import Path
GENERIC_LFAHDA = "BO_ 1157 LFAHDA_MFC: 4 XXX"
REFRESH_LFAHDA = "BO_ 1157 LFAHDA_MFC: 8 XXX"
def main() -> None:
dbc_dir = Path(__file__).resolve().parents[2]
source = dbc_dir / "hyundai_kia_generic.dbc"
target = dbc_dir / "hyundai_can_refresh_generated.dbc"
dbc = source.read_text(encoding="utf-8")
if dbc.count(GENERIC_LFAHDA) != 1:
raise RuntimeError(f"expected exactly one {GENERIC_LFAHDA!r} definition")
target.write_text(dbc.replace(GENERIC_LFAHDA, REFRESH_LFAHDA, 1), encoding="utf-8")
if __name__ == "__main__":
main()
@@ -45,6 +45,7 @@ def parse_args() -> argparse.Namespace:
parser.add_argument("--search-after", type=float, default=1.0, help="Seconds after each bookmark to scan for the most sign-like frame.")
parser.add_argument("--localize-sample-every", type=float, default=0.25, help="Seconds between frames while searching for the best sign candidate.")
parser.add_argument("--top-k", type=int, default=1, help="Number of localized candidates to keep per bookmark.")
parser.add_argument("--model-only", action="store_true", help="Match the production detector/classifier path without crop OCR.")
parser.add_argument("--overwrite", action="store_true", help="Overwrite any existing outputs.")
return parser.parse_args()
@@ -227,7 +228,7 @@ def main() -> int:
args.search_after,
args.localize_sample_every,
):
scored = score_frame(daemon, frame_bgr)
scored = score_frame(daemon, frame_bgr, use_ocr=not args.model_only)
if scored is None:
continue
ranked.append((scored["score"], relative_time_s, source_video_path, frame_bgr, scored))