Yolo Detect Khmer Math
State-of-the-art YOLOv8 model for detecting Khmer printed text lines and mathematical formulas across MoEYS textbooks and exam papers.
Source du modèle
- Type
- Other
- Taille du fichier
- 5,25–11,7 MB
- Version
- vRevision 940548c
- Mis à jour
- 21 oct. 2026
- Téléchargements
- 723
- Source
- Hugging Face
Description de la source
YOLO Khmer Math and Text Line Detector (v5.0 - khmer_V3dectect)
State-of-the-art YOLOv8 model for detecting Khmer printed text lines and mathematical formulas across MoEYS textbooks and exam papers.
Highlights of the Model (v5.0 / khmer_V3dectect)
- 96.78% mAP@50: Peak performance across all versions.
- 81.96% mAP@50-95: High bounding box tightness and precision for text and formula cropping.
- 93.33% Recall: Captures complex stacked formulas, sub/superscripts, fractions, and Khmer diacritics.
- 94.89% Precision: Low false positives on empty document spaces or page margins.
- Lightweight and Fast: Compact model (~6.2 MB PyTorch
.pt, ~11.7 MB ONNX.onnx) optimized for edge and web execution.
Model Checkpoints and Download Links
| Checkpoint Name | Version | Format | Key Metrics | Direct Download Link |
|---|---|---|---|---|
best.pt | v5.0 (Default Latest) | .pt (~6.2 MB) | mAP50: 96.78% | mAP50-95: 81.96% | Recall: 93.33% | Download best.pt |
best.onnx | v5.0 (ONNX Runtime) | .onnx (~11.7 MB) | Cross-platform Web/Desktop/Mobile ready | Download best.onnx |
best_khmer_V3dectect_96pct.pt | v5.0 (Archive) | .pt (~6.2 MB) | Dedicated checkpoint for khmer_V3dectect 30 epochs run | Download |
best_khmer_V3dectect_96pct.onnx | v5.0 (Archive ONNX) | .onnx (~11.7 MB) | Dedicated ONNX for khmer_V3dectect | Download |
best_khmer_Dectecv2_30e.pt | v4.0 | .pt (~6.2 MB) | mAP50: 91.22% | Recall: 86.58% | Download |
best_khmer_line_detect_43pct.pt | v3.1 | .pt (~5.9 MB) | Selected high-density lines | Download |
best_yolo_khmer_math_physics_v3.pt | v3.0 | .pt (~5.5 MB) | Math and Physics 54.4K images | Download |
best_yolo_khmer_math_v2.pt | v2.0 | .pt (~6.2 MB) | Math G7-G12 Full Textbooks | Download |
Version Evolution and Benchmark
| Version | Epochs | mAP@50 | mAP@50-95 | Recall | Precision | Status |
|---|---|---|---|---|---|---|
| v5.0 (khmer_V3dectect) | 30 | 96.78% | 81.96% | 93.33% | 94.89% | Current Champion (SOTA) |
| v4.0 (Dectecv2) | 30 | 91.22% | 70.11% | 86.58% | 90.99% | Previous Stable |
| v3.1 (line_detect_43pct) | 20 | ~80.5% | 61.2% | 78.40% | 88.2% | Refined Lines |
| v3.0 (math_physics_v3) | 30 | 74.93% | 55.25% | 76.66% | 82.1% | Unified Curriculum |
| v2.0 (khmer_math_v2) | 30 | 83.83% | 64.85% | 79.26% | 85.0% | Math G7-G12 |
| v1.0 (Baseline OBB) | 20 | 43.31% | 29.62% | 50.36% | - | Initial Experiment |
Quickstart Inference
Python (Ultralytics)
from ultralytics import YOLO
from huggingface_hub import hf_hub_download
# Download best model directly from Hugging Face
model_path = hf_hub_download(
repo_id="krotreaksmey/Yolo_Detect_khmer_math",
filename="best.pt"
)
# Load model
model = YOLO(model_path)
# Predict on full textbook or exam page
results = model.predict(
source="textbook_page.png",
conf=0.25,
iou=0.45,
imgsz=640
)
# Extract detected text/math lines
for r in results:
for box in r.boxes:
x1, y1, x2, y2 = box.xyxy[0].tolist()
conf = float(box.conf[0])
cls_id = int(box.cls[0])
print(f"Line detected at [{x1:.1f}, {y1:.1f}, {x2:.1f}, {y2:.1f}] (conf: {conf:.2f})")
ONNX Runtime (Python / WebAssembly / C++)
import onnxruntime as ort
import numpy as np
from PIL import Image
from huggingface_hub import hf_hub_download
onnx_path = hf_hub_download(
repo_id="krotreaksmey/Yolo_Detect_khmer_math",
filename="best.onnx"
)
session = ort.InferenceSession(onnx_path)
# Preprocess image with 640x640 letterboxing
im = Image.open("textbook_page.png").convert("RGB")
w, h = im.size
scale = min(640 / w, 640 / h)
nw, nh = int(w * scale), int(h * scale)
im_resized = im.resize((nw, nh), Image.Resampling.BILINEAR)
padded = Image.new("RGB", (640, 640), (114, 114, 114))
pad_x = (640 - nw) // 2
pad_y = (640 - nh) // 2
padded.paste(im_resized, (pad_x, pad_y))
input_arr = np.array(padded, dtype=np.float32) / 255.0
input_arr = np.transpose(input_arr, (2, 0, 1))[np.newaxis, ...]
outputs = session.run(["output0"], {"images": input_arr})
predictions = outputs[0] # shape: (1, 5, 8400)
Training Visualizations
Metric Progress and Loss Curves
Training Metrics
Intended Use and Applications
- Khmer MoEYS Math and Science OCR: First-stage line segmentation before passing crops to PARSeq / TrOCR recognition models.
- Interactive Education and AI Vision Teacher: Automatic extraction and solving of math exercises from photo and PDF submissions.
- Document Digitization: Archiving Grade 1 to 12 national exams, curriculum books, and research documents.
Citation
@misc{yolo_khmer_math_v5,
title={YOLO Khmer Math and Text Line Detection Model (v5.0)},
author={krotreaksmey},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math}
}
Sources
1 source
Sources
1 sourceVérifié 21 oct.
Artefacts du modèle
13 artefacts
Artefacts du modèle
13 artefactsbest_khmer_line_detect_43pct.onnx
onnx · 11,7 MB · SHA-256 7cc37d1e65c0…ec25 · Hugging Face
Téléchargerbest_yolo_khmer_math_physics_v3.onnx
onnx · 10,1 MB · SHA-256 b7b97b270cee…30f6 · Hugging Face
Téléchargerbest_yolo_khmer_math_physics_v3.pt
pt · 5,25 MB · SHA-256 b5fd96fc162c…a969 · Hugging Face
TéléchargerExtraits de sources
3 extraits
Extraits de sources
3 extraits--- language: - km - en license: mit tags: - yolo - yolov8 - object-detection - khmer-ocr - khmer-text - math-ocr - document-ai - line-detection - ultralytics - moeys pipeline_tag: object-detection model-index: - name: Yolo_Detect_khmer_math results: - task: type: object-detection name: Khmer Math and Text Line Detection dataset: name: Khmer STEM MoEYS Dataset type: khmer-stem-moeys metrics: - type: mAP@50 value: 0.9678 name: mAP@50 - type: mAP@50-95 value: 0.8196 name: mAP@50-95 - type: recall value: 0.9333 name: Recall - type: precision value: 0.9489 name: Precision --- # YOLO Khmer Math and Text Line Detector (v5.0 - khmer_V3dectect) State-of-the-art YOLOv8 model for detecting Khmer printed text lines and mathematical formulas across MoEYS textbooks and exam papers. --- ## Highlights of the Model (v5.0 / khmer_V3dectect) - **96.78% mAP@50**: Peak performance across all versions. - **81.96% mAP@50-95**: High bounding box tightness and precision for text and formula cropping. - **93.33% Recall**: Captures complex stacked formulas, sub/superscripts, fractions, and Khmer diacritics. - **94.89% Precision**: Low false positives on empty document spaces or page margins. - **Lightweight and Fast**: Compact model (~6.2 MB PyTorch `.pt`, ~11.7 MB ONNX `.onnx`) optimized for edge and web execution. --- ## Model Checkpoints and Download Links | Checkpoint Name | Version | Format | Key Metrics | Direct Download Link | | :--- | :---: | :---: | :--- | :--- | | **`best.pt`** | v5.0 (Default Latest) | `.pt` (~6.2 MB) | mAP50: 96.78% \| mAP50-95: 81.96% \| Recall: 93.33% | [Download best.pt](https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math/resolve/main/best.pt) | | **`best.onnx`** | v5.0 (ONNX Runtime) | `.onnx` (~11.7 MB) | Cross-platform Web/Desktop/Mobile ready | [Download best.onnx](https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math/resolve/main/best.onnx) | | **`best_khmer_V3dectect_96pct.pt`** | v5.0 (Archive) | `.pt` (~6.2 MB) | Dedicated checkpoint for khmer_V3dectect 30 epochs run | [Download](https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math/resolve/main/best_khmer_V3dectect_96pct.pt) | | **`best_khmer_V3dectect_96pct.onnx`** | v5.0 (Archive ONNX) | `.onnx` (~11.7 MB) | Dedicated ONNX for khmer_V3dectect | [Download](https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math/resolve/main/best_khmer_V3decte...
--- language: - km - en tags: - yolo - object-detection - khmer - math - obb - oriented-bounding-box - document-understanding library_name: ultralytics license: apache-2.0 pipeline_tag: object-detection --- # YOLOv8 OBB - Khmer & Math Detection YOLOv8n-obb model for detecting **Khmer text** and **LaTeX math expressions** in document images using oriented bounding boxes (OBB). ## Model Details | Property | Value | |----------|-------| | Architecture | YOLOv8n-obb (nano) | | Task | Oriented Object Detection | | Input | RGB image (1280x1280) | | Output | Oriented bounding boxes + class + confidence | | Framework | Ultralytics YOLOv8 | ## Classes | ID | Name | Description | |----|------|-------------| | 0 | `khmer` | Khmer script text | | 1 | `expression` | LaTeX math formulas | ## Metrics | Metric | Value | |--------|-------| | mAP50 | **0.995** | | mAP50-95 | **0.918** | ## Training Details - **Dataset**: 9,770 train + 2,443 val synthetic document pages - **Epochs**: 50 - **Image size**: 1280 - **Device**: M3 MacBook Pro (CPU/MPS) - **Data augmentation**: Mosaic, mixup, HSV, flip ## Usage ### Python (Ultralytics) ```python from ultralytics import YOLO # Load model model = YOLO("best_yolo_khmer_math.pt") # Run inference results = model.predict("document.jpg", conf=0.3) for result in results: if result.obb: for obb in result.obb: cls = int(obb.cls[0]) conf = float(obb.conf[0]) name = "khmer" if cls == 0 else "expression" print(f"Class: {name}, Confidence: {conf:.2f}") # obb.xyxyxyxy gives 4 corner points (x1,y1,x2,y2,x3,y3,x4,y4) print(f"Points: {obb.xyxyxyxy[0].tolist()}") ``` ### Download ```python from huggingface_hub import hf_hub_download path = hf_hub_download( repo_id="krotreaksmey/Yolo_Detect_khmer_math", filename="best_yolo_khmer_math.pt" ) model = YOLO(path) ``` ## Test Model ### Live Demo on Hugging Face Spaces [](https://huggingface.co/spaces/krotreaksmey/khmer-math-detector) Upload a document image directly in your browser. No installation needed. ### Google Colab (Free GPU) [](https://colab.research.google.com/github/Krotreaksmey2200/yolo/blob/main/Colab_Test_Model.ipynb) Upload a document image and see detection results with bounding boxes and c...
Source context: 723 downloads · 0 likes · Pipeline object-detection · Library ultralytics · Repo krotreaksmey/Yolo_Detect_khmer_math
