| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
| informatique:ai_lm:ai_vision [30/03/2026 17:49] – [Détections par départements] cyrille | informatique:ai_lm:ai_vision [21/04/2026 08:52] (Version actuelle) – [GLM-OCR] cyrille |
|---|
| Nécessite un modèle multimodal et un fichier ''mmproj'' approprié. | Nécessite un modèle multimodal et un fichier ''mmproj'' approprié. |
| |
| ==== Tentatives ==== | |
| |
| * ticket ouvert: https://github.com/ggml-org/llama.cpp/issues/19639 | |
| |
| |
| Avec **llama-mtmd-cli** et **gemma-3-4b-it** : | |
| |
| * [[https://huggingface.co/ggml-org/gemma-3-4b-it-GGUF/resolve/main/gemma-3-4b-it-Q4_K_M.gguf|gemma-3-4b-it-Q4_K_M.gguf]] | |
| * [[https://huggingface.co/ggml-org/gemma-3-4b-it-GGUF/resolve/main/mmproj-model-f16.gguf|mmproj-model-f16.gguf]] | |
| |
| <code> | |
| # gemma-3-4b-it-UD-Q8_K_XL | |
| $ time ~/llama.cpp/build/bin/llama-mtmd-cli --log-timestamps \ | |
| -m ~/Data/gemma-3-4b-it-UD-Q8_K_XL.gguf \ | |
| --mmproj ~/Data/mmproj-model-f16.gguf \ | |
| --image ~/Data/screenshot_20260214-141126.png -p 'Vois tu des panneaux solaires sur cette image ?' | |
| |
| main: loading model: ~/Data/gemma-3-4b-it-UD-Q8_K_XL.gguf | |
| WARN: This is an experimental CLI for testing multimodal capability. | |
| For normal use cases, please use the standard llama-cli | |
| encoding image slice... | |
| image slice encoded in 789 ms | |
| decoding image batch 1/1, n_tokens_batch = 256 | |
| sched_reserve: reserving ... | |
| sched_reserve: CUDA0 compute buffer size = 517.12 MiB | |
| sched_reserve: CUDA_Host compute buffer size = 269.02 MiB | |
| sched_reserve: graph nodes = 1369 | |
| sched_reserve: graph splits = 2 | |
| sched_reserve: reserve took 109.44 ms, sched copies = 1 | |
| image decoded (batch 1/1) in 201 ms | |
| sched_reserve: reserving ... | |
| sched_reserve: CUDA0 compute buffer size = 517.12 MiB | |
| sched_reserve: CUDA_Host compute buffer size = 269.02 MiB | |
| sched_reserve: graph nodes = 1369 | |
| sched_reserve: graph splits = 2 | |
| sched_reserve: reserve took 188.38 ms, sched copies = 1 | |
| |
| Oui, je vois des panneaux solaires sur l'image. Ils sont disposés sur le toit du bâtiment principal au centre de l'image. | |
| |
| |
| llama_perf_context_print: load time = 2846.21 ms | |
| llama_perf_context_print: prompt eval time = 852.69 ms / 278 tokens ( 3.07 ms per token, 326.03 tokens per second) | |
| llama_perf_context_print: eval time = 542.06 ms / 30 runs ( 18.07 ms per token, 55.34 tokens per second) | |
| llama_perf_context_print: total time = 2344.07 ms / 308 tokens | |
| llama_perf_context_print: graphs reused = 29 | |
| |
| real 0m8,165s | |
| user 0m4,880s | |
| sys 0m3,269s | |
| |
| # gemma-3-4b-it-Q4_K_M.gguf | |
| |
| Oui, je vois des panneaux solaires sur l'image. Ils sont installés sur le toit du bâtiment principal, qui est une grande structure rectangulaire. | |
| |
| |
| llama_perf_context_print: load time = 1614.35 ms | |
| llama_perf_context_print: prompt eval time = 856.85 ms / 278 tokens ( 3.08 ms per token, 324.45 tokens per second) | |
| llama_perf_context_print: eval time = 359.10 ms / 33 runs ( 10.88 ms per token, 91.90 tokens per second) | |
| llama_perf_context_print: total time = 2049.84 ms / 311 tokens | |
| llama_perf_context_print: graphs reused = 32 | |
| |
| real 0m6,531s | |
| user 0m3,426s | |
| sys 0m3,041s | |
| </code> | |
| |
| ===== Yolo ===== | ===== Yolo ===== |
| * {{ :informatique:ai_lm:ai_vision:yolo:yolo26l_solar_panel-s4.pt.zip |}} | * {{ :informatique:ai_lm:ai_vision:yolo:yolo26l_solar_panel-s4.pt.zip |}} |
| * https://huggingface.co/Cyrille37/solar-panels-IGN-bdortho | * https://huggingface.co/Cyrille37/solar-panels-IGN-bdortho |
| | |
| | Travaux similaires: |
| | |
| | * [[https://gabrielkasmi.github.io/deeppvmapper/|Enhancing the Reliability of Deep Learning Models to Improve the Observability of French Rooftop Photovoltaic Installations]] par Gabriel Kasmi pour sa thèse à Université Paris sciences et lettres. |
| | * [[https://huggingface.co/agademer/yolo-remote-sensing-photovoltaic|agademer/yolo-remote-sensing-photovoltaic]] - This model detects buildings and rooftop photovoltaic panels from remote sensing imagery using YOLO. IGN's Orthophotos (960x960 pixels aka 192x192 meters) from South-West of France (Castelnaudary to Perpignan), Montpellier surroundings and South of Paris. Rooftop photovoltaic panels and buildings shapes identified with the help of OpenStreetMap. |
| | |
| |
| |
| * 82 Tarn-et-Garonne {{ :informatique:ai_lm:ai_vision:yolo:solar-panels_82.geojson.zip |}} | * 82 Tarn-et-Garonne {{ :informatique:ai_lm:ai_vision:yolo:solar-panels_82.geojson.zip |}} |
| * [[https://maproulette.org/browse/challenges/54636|Challenge maproulette]] <html><img src="https://tools.comptoir.net/maproulette-completion-badge/badge.php?id=54636" height="25"/></html> | * [[https://maproulette.org/browse/challenges/54636|Challenge maproulette]] <html><img src="https://tools.comptoir.net/maproulette-completion-badge/badge.php?id=54636" height="25"/></html> |
| | |
| | ===== OCR ===== |
| | |
| | ==== LiteParse ==== |
| | |
| | A fast, local PDF parsing with spatial text parsing, OCR, and bounding boxes. Open-source document parser from [[https://developers.llamaindex.ai/liteparse/|LlamaIndex]] |
| | |
| | https://github.com/run-llama/liteparse |
| | |
| | ==== GLM-OCR ==== |
| | |
| | Avec llama.cpp et le modèle [[https://huggingface.co/ggml-org/GLM-OCR-GGUF|GLM-OCR-f16.gguf]] avec son fichier mmproj-GLM-OCR-Q8_0.gguf |
| | |
| | <code> |
| | ~/Code/bronx/AI_Coding/llama.cpp-86/build/bin/llama-server --port 8012 \ |
| | -m ~/Data/AI_ModelsOCR/GLM-OCR-f16.gguf \ |
| | --mmproj ~/Data/AI_ModelsOCR/mmproj-GLM-OCR-Q8_0.gguf |
| | </code> |
| | |
| | Avec les images de pages scannées du fichier https://www.cotes-darmor.gouv.fr/contenu/telechargement/60849/507248/file/recueil-22-2023-079-recueil-des-actes-administratifs-special.pdf |
| | |
| | <code> |
| | Avec CPU i7-1360P 13thGen |
| | real 0m47,583s, 0m32,031s |
| | user 0m0,112s, 0m0,110s |
| | sys 0m0,025s, 0m0,025s |
| | |
| | Avec RTX 3060 |
| | real 0m5,929s, 0m3,367s |
| | user 0m0,099s, 0m0,104s |
| | sys 0m0,027s, 0m0,027s |
| | </code> |
| | |
| | La page 8 est un tableau et les données dans les cellules sont très bien extraites, les phrases sur plusieurs lignes dans une cellule sont bien extraites. |
| | |
| | Avec le prompt : "''Extrais le texte de cette image en préservant la structure (titres, listes, paragraphes). Corrigé les erreurs d'OCR si nécessaire. Réponds avec LE FORMAT MARKDOWN.''" la page 8 donne du Markdown alors que la page 9 donne du HTML ... |
| | |
| | Alors qu'avec le prompt : "''Extract the text from this image, preserving the structure (headings, lists, paragraphs). Correct any OCR errors where necessary. Please reply in MARKDOWN FORMAT.''" les pages 8 et 9 sont bien en Markdown. Comme quoi **le modèle comprends mieux l'anglais**. |
| | |
| | Les tables sont bien extraites mais **pas toujours bien rendues** dans la réponse. Après quelques essais le prompt qui fonctionne mieux : "''Extract the text from this image, preserving the structure (headings, lists, paragraphs) and make sure you KEEP THE TABLES in good condition. Correct any OCR errors where necessary. Fine Reply in MARKDOWN FORMAT.''" |
| | |
| | 😩 voilà qu'après plusieurs usages il n'y a plus de Markdown pour les titres ... |
| | |
| | 👌 J'ai changé de stratégie: ne plus extraire la mise en forme, mais seulement le texte page par page, avec extraction de quelques entités comme "auteur", "date", "sujet" et un "résumé". Là le model GLM-OCR-f16 est très efficace. |
| | |
| | ==== Qwen2.5-VL-7B-Instruct ==== |
| | |
| | https://huggingface.co/unsloth/Qwen2.5-VL-7B-Instruct-GGUF |
| | |
| | Bien meilleurs résultats pour la structure en Markdown mais beaucoup plus gourmand en mémoire et donc plus lent à cause de l'usage du CPU, même avec du Q4. 😩 |
| | |
| | <code> |
| | ~/Code/bronx/AI_Coding/llama.cpp-86/build/bin/llama-server --port 8012 \ |
| | -m ~/Data/AI_ModelsOCR/Qwen2.5-VL-7B-Instruct-UD-Q4_K_XL.gguf \ |
| | --mmproj ~/Data/AI_ModelsOCR/mmproj-F16.gguf -ngl 20 |
| | |
| | real 0m39,938s, 0m45,901s |
| | user 0m0,116s, 0m0,105s |
| | sys 0m0,024s, 0m0,027s |
| | </code> |
| | |
| | ==== DeepSeek-OCR-GGUF ==== |
| | |
| | [[https://huggingface.co/ggml-org/DeepSeek-OCR-GGUF|ggml-org/DeepSeek-OCR-GGUF]] |
| | |
| | Tient dans la VRAM de la RTX3060. |
| | |
| | Gère bien le Markdown, mais les résultats sont alléatoires ... Et de nombreuses allucinations 😩 |
| |
| |