Implement DeepMosaics restoration engine in HVideoTool: updated configuration options, integrated into the UI, and enhanced documentation in README and CLAUDE.md. The restoration process now supports both inpainting and generative models, with necessary setup instructions included.

This commit is contained in:
Leonid Pershin
2026-06-07 04:02:25 +03:00
parent ddc8543647
commit 7f0121b7df
9 changed files with 413 additions and 27 deletions
+20 -8
View File
@@ -1,22 +1,34 @@
"""Restorer factory: build a Restorer by name.
"""Restorer factory: build a Restorer from the app config.
Currently only the cv2 inpaint baseline is wired. Generative engines
(DeepMosaics / LADA BasicVSR++) are placeholders — they need model weights and a
CUDA GPU, and raise a clear, actionable error until integrated. See README.
- ``inpaint``: cv2 baseline (no weights, no GPU; fills, doesn't reconstruct).
- ``deepmosaics``: real generative mosaic removal via a user-installed DeepMosaics
(subprocess). Needs the DeepMosaics folder + clean weights + (ideally) a CUDA GPU.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from .base import Restorer
from .inpaint import InpaintRestorer
if TYPE_CHECKING: # avoid importing AppConfig at runtime here (not needed)
from ...config import AppConfig
def build_restorer(name: str = "inpaint", model_path: str | None = None) -> Restorer:
def build_restorer(name: str = "inpaint", config: "AppConfig | None" = None) -> Restorer:
if name == "inpaint":
return InpaintRestorer()
if name in ("deepmosaics", "lada"):
if name == "deepmosaics":
from .deepmosaics import DeepMosaicsRestorer
if config is None:
raise ValueError("Для DeepMosaics нужны настройки (config).")
return DeepMosaicsRestorer(
config.dm_dir, config.dm_model, config.dm_python, config.dm_gpu
)
if name == "lada":
raise ValueError(
"Генеративное восстановление пока не подключено.\n"
"Нужна модель (DeepMosaics / LADA) и GPU (CUDA). См. README → Восстановление."
"Движок LADA пока не подключён. Используйте DeepMosaics или inpaint. См. README."
)
raise ValueError(f"Неизвестный режим восстановления: {name!r}")