mirror of
https://github.com/TaterTotterson/microWakeWord-Trainer-Nvidia-Docker.git
synced 2026-08-12 07:55:33 -06:00
Point Docker trainer at native Tater firmware
This commit is contained in:
@@ -497,6 +497,7 @@ calibration_path = Path(os.environ.get("CALIBRATION_PATH", ""))
|
||||
language = (os.environ.get("LANGUAGE", "en") or "en").strip().lower()
|
||||
probability_cutoff = 0.97
|
||||
sliding_window_size = 5
|
||||
calibration = {}
|
||||
|
||||
if calibration_path.exists():
|
||||
try:
|
||||
@@ -510,21 +511,60 @@ if calibration_path.exists():
|
||||
except Exception as exc:
|
||||
print(f"⚠️ Failed to read detector calibration ({exc}); using defaults.")
|
||||
|
||||
probability_cutoff = round(probability_cutoff, 3)
|
||||
sliding_window_size = max(1, min(10, int(sliding_window_size)))
|
||||
selected_metrics = calibration.get("selected_metrics") if isinstance(calibration.get("selected_metrics"), dict) else {}
|
||||
evaluation = calibration.get("evaluation") if isinstance(calibration.get("evaluation"), dict) else {}
|
||||
close_miss_threshold = max(0.01, min(0.99, round(max(0.01, probability_cutoff - 0.19), 3)))
|
||||
|
||||
meta = {
|
||||
"type": "micro",
|
||||
"wake_word": os.environ["WAKE_WORD_TITLE"],
|
||||
"label": os.environ["WAKE_WORD_TITLE"].replace("_", " ").title(),
|
||||
"author": "Tater Totterson",
|
||||
"website": "https://github.com/TaterTotterson/microWakeWord-Trainer-Nvidia-Docker.git",
|
||||
"model": os.environ["TFLITE_FILENAME"],
|
||||
"trained_languages": [language],
|
||||
"version": 2,
|
||||
"model_format": "tflite_stream_state_internal_quant",
|
||||
"quantization": "int8",
|
||||
"sample_rate": 16000,
|
||||
"micro": {
|
||||
"probability_cutoff": round(probability_cutoff, 2),
|
||||
"probability_cutoff": probability_cutoff,
|
||||
"sliding_window_size": sliding_window_size,
|
||||
"feature_step_size": 10,
|
||||
"tensor_arena_size": 30000,
|
||||
"minimum_esphome_version": "2024.7.0",
|
||||
},
|
||||
"tater_native": {
|
||||
"format_version": 1,
|
||||
"wake_threshold": probability_cutoff,
|
||||
"wake_sliding_window": sliding_window_size,
|
||||
"close_miss_threshold": close_miss_threshold,
|
||||
"frontend": {
|
||||
"name": "tflm_microfrontend",
|
||||
"sample_rate": 16000,
|
||||
"feature_duration_ms": 30,
|
||||
"feature_step_ms": 10,
|
||||
"feature_size": 40,
|
||||
"input_feature_frames": 2,
|
||||
"lower_band_limit": 125.0,
|
||||
"upper_band_limit": 7500.0,
|
||||
},
|
||||
"recommended_for": ["tater-native-satellite", "voice-pe"],
|
||||
},
|
||||
"calibration": {
|
||||
"target_false_accepts_per_hour": calibration.get("target_false_accepts_per_hour"),
|
||||
"selected_false_accepts_per_hour_limit": calibration.get("selected_false_accepts_per_hour_limit"),
|
||||
"recall": selected_metrics.get("recall"),
|
||||
"false_accepts_per_hour": selected_metrics.get("false_accepts_per_hour"),
|
||||
"ambient_hours": selected_metrics.get("ambient_hours"),
|
||||
"positive_dataset": evaluation.get("positive_dataset"),
|
||||
"ambient_dataset": evaluation.get("ambient_dataset"),
|
||||
"positive_tracks": evaluation.get("positive_tracks"),
|
||||
"ambient_tracks": evaluation.get("ambient_tracks"),
|
||||
"generated_at": calibration.get("generated_at"),
|
||||
},
|
||||
}
|
||||
json_path.write_text(json.dumps(meta, indent=4) + "\n", encoding="utf-8")
|
||||
PY
|
||||
|
||||
Reference in New Issue
Block a user