Enhance HVideoTool's detection and restoration features: added support for tracking the model used in detections, improved temporal coherence by allowing the use of already-restored frames in the restoration process, and updated the UI to reflect these changes with new indicators and configuration options. Documentation in CLAUDE.md has been updated accordingly.

This commit is contained in:
Leonid Pershin
2026-06-07 08:40:57 +03:00
parent 7a225efa85
commit cabb4e3d3d
11 changed files with 168 additions and 27 deletions
+17
View File
@@ -13,6 +13,7 @@ from __future__ import annotations
from pathlib import Path
from PySide6.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QDialogButtonBox,
@@ -49,10 +50,23 @@ class RestoreDialog(QDialog):
self.dm_gpu = QLineEdit(config.dm_gpu or "0")
self.dm_gpu.setPlaceholderText("0 = первая CUDA-карта, -1 = CPU (медленно)")
# Video engine only: feed already-restored past frames into the temporal window.
self.feed_restored = QCheckBox(
"Подавать уже расцензуренные прошлые кадры в окно (эксперим.)"
)
self.feed_restored.setChecked(bool(getattr(config, "dm_feed_restored", True)))
self.feed_restored.setToolTip(
"Только для видеодвижка: прошлые соседние кадры в окне берутся из уже\n"
"восстановленных результатов, а не из оригинала с мозаикой — больше\n"
"временной связности. Сеть обучалась на мозаичных окнах, так что эффект\n"
"не гарантирован; выключите для точной реализации DeepMosaics."
)
form = QFormLayout(self)
form.addRow("Движок:", self.engine)
form.addRow("Модель:", self._with_browse(self.model_combo, self._browse_model))
form.addRow("GPU id:", self.dm_gpu)
form.addRow("", self.feed_restored)
hint = QLabel(
"Модели берутся из models/deepmosaics (рядом нужен mosaic_position.pth).\n"
"• Картинка: clean_youknow_resnet_9blocks.pth — покадрово.\n"
@@ -98,10 +112,12 @@ class RestoreDialog(QDialog):
def _sync(self) -> None:
is_dm = self.engine.currentData() in ("deepmosaics", "deepmosaics_video")
is_video = self.engine.currentData() == "deepmosaics_video"
# The model list differs per engine (image vs video weights) — repopulate.
self._populate_models(self._cfg.dm_model)
self.model_combo.setEnabled(is_dm)
self.dm_gpu.setEnabled(is_dm)
self.feed_restored.setEnabled(is_video) # only the temporal engine has a window
def _browse_model(self) -> None:
p, _ = QFileDialog.getOpenFileName(self, "Веса DeepMosaics", "", "Веса (*.pth);;Все файлы (*.*)")
@@ -114,3 +130,4 @@ class RestoreDialog(QDialog):
self._cfg.restorer = self.engine.currentData()
self._cfg.dm_model = self.model_combo.currentData()
self._cfg.dm_gpu = self.dm_gpu.text().strip() or "0"
self._cfg.dm_feed_restored = self.feed_restored.isChecked()