Enhance HVideoTool's detection and restoration capabilities: introduced per-model overlay threshold settings and cross-model non-maximum suppression (NMS) to improve detection accuracy. Updated configuration management to support these features, and refined the UI for better user experience. Documentation in CLAUDE.md has been updated to reflect these changes.

This commit is contained in:
Leonid Pershin
2026-06-08 04:06:50 +03:00
parent cabb4e3d3d
commit 8a366ed43d
11 changed files with 906 additions and 146 deletions
+17 -3
View File
@@ -19,6 +19,7 @@ threshold, restore engine). Global ``settings.json`` only seeds the defaults for
from __future__ import annotations
import json
import os
from dataclasses import dataclass, field
from datetime import datetime
from pathlib import Path
@@ -38,6 +39,9 @@ _SETTING_KEYS = (
"detector",
"detector_models",
"default_threshold",
"model_thresholds",
"cross_model_nms",
"nms_iou",
"restorer",
"dm_dir",
"dm_model",
@@ -139,9 +143,19 @@ class Project:
"settings": self.settings,
}
self.root.mkdir(parents=True, exist_ok=True)
self.project_file.write_text(
json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8"
)
# Crash-safe write (sibling .tmp + atomic os.replace): never truncate a good
# project.json if the app/PC dies mid-save.
text = json.dumps(payload, ensure_ascii=False, indent=2)
tmp = self.project_file.with_name(PROJECT_FILE + ".tmp")
try:
tmp.write_text(text, encoding="utf-8")
os.replace(tmp, self.project_file)
finally:
if tmp.exists():
try:
tmp.unlink()
except OSError:
pass
# ----------------------------------------------------- settings <-> config
def apply_to_config(self, cfg: AppConfig) -> None: