Object Detection
ultralytics
Khmer
English
yolo
khmer
math
obb
oriented-bounding-box
document-understanding
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:
# Couldn't find a valid YOLO version tag. # Replace XX with the correct version. from ultralytics import YOLOvXX model = YOLOvXX.from_pretrained("krotreaksmey/Yolo_Detect_khmer_math") source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
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)
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
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
Upload a document image directly in your browser. No installation needed.
Google Colab (Free GPU)
Upload a document image and see detection results with bounding boxes and confidence scores.
Local Gradio App
pip install gradio ultralytics huggingface_hub
python app.py
Then open http://localhost:7860 in your browser.
Output Format
Each detection returns an oriented bounding box with:
- 4 corner points:
(x1,y1), (x2,y2), (x3,y3), (x4,y4)in normalized coordinates - Class ID: 0 (khmer) or 1 (expression)
- Confidence score: 0.0 to 1.0
Related
krotreaksmey/khmer_mathโ OCR training dataset (10,499 samples)krotreaksmey/synthetic_khmer_mathโ Full OCR dataset (146,914 samples)
Citation
@misc{yolo_khmer_math_2026,
title={YOLOv8 OBB - Khmer & Math Detection},
author={krotreaksmey},
year={2026},
url={https://huggingface.co/krotreaksmey/Yolo_Detect_khmer_math}
}
- Downloads last month
- 68