Object Detection
ultralytics
ONNX
Khmer
English
yolo
yolov8
khmer-ocr
khmer-text
math-ocr
document-ai
line-detection
moeys
Eval Results (legacy)
Instructions to use krotreaksmey/Yolo_Detect_khmer_math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use krotreaksmey/Yolo_Detect_khmer_math with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("krotreaksmey/Yolo_Detect_khmer_math", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
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
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}
}
- Downloads last month
- 701
Space using krotreaksmey/Yolo_Detect_khmer_math 1
Evaluation results
- mAP@50 on Khmer STEM MoEYS Datasetself-reported0.968
- mAP@50-95 on Khmer STEM MoEYS Datasetself-reported0.820
- Recall on Khmer STEM MoEYS Datasetself-reported0.933
- Precision on Khmer STEM MoEYS Datasetself-reported0.949
