Ajout de l'inpainting LaMa (big-lama ONNX) pour la suppression intelligente du texte
- nouveau module src/scalper/inpaint.py : protocol Inpainter, SimpleInpainter (remplissage par couleur de fond, ex-comportement) et LamaInpainter (big-lama advimman/lama via port ONNX Carve/LaMa-ONNX, onnxruntime CPU) : crop carre 512x512 avec contexte par region, masque polygone OCR (poly) ou rectangle dilate, composite uniquement des pixels masques a la resolution d'origine ; modele telecharge une fois (208 Mo, sha256 verifie) dans SCALPER_LAMA_CACHE, SCALPER_LAMA_MODEL pour un fichier local - selection par SCALPER_INPAINT_ENGINE / --inpaint-engine / "inpaint_engine" (simple|lama|auto, defaut auto = lama si onnxruntime installe) - typeset.py : inpainting de toute l'image via l'Inpainter puis retypographie de la traduction (Pillow) ; ocr.py : PaddleOCR expose le quadrilatere poly - pipeline/cli/server : parametre inpaint_engine cable de bout en bout - packaging : extra .[inpaint-lama] (onnxruntime+numpy), Dockerfile, entrypoint.sh (SCALPER_LAMA_CACHE=/app/data/.lama), docker-compose (SCALPER_INPAINT_ENGINE=lama), .env.example, README - tests : tests/test_inpaint.py (moteurs, masque, crop, telechargement sha256, LaMa avec session factice + test reel optionnel SCALPER_TEST_LAMA_MODEL) Verifie en reel sur une page du out/ : 0 pixel modifie hors masques, contraste du texte efface dans les boites, traduction reinseree par-dessus (~2,2 s/region en CPU). Suite complete : 74 passed, 1 skipped. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
1 parent
bbde55e27b
commit
74f47096cd
14 files changed
+768
-69
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ WORKDIR /app
|
||||
COPY pyproject.toml README.md ./
|
||||
COPY src ./src
|
||||
|
||||
RUN pip install --no-cache-dir ".[ocr,ocr-paddle]"
|
||||
RUN pip install --no-cache-dir ".[ocr,ocr-paddle,inpaint-lama]"
|
||||
|
||||
RUN useradd -m scalper && mkdir -p /app/data /app/out && chown -R scalper:scalper /app
|
||||
|
||||
|
||||
Reference in new issue
Block a user