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

Open in Spaces

Upload a document image directly in your browser. No installation needed.

Google Colab (Free GPU)

Open In Colab

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

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
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using krotreaksmey/Yolo_Detect_khmer_math 1