GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - mrrtmob/kiri-ocr: Kiri OCR is a lightweight, OCR library for English and Khmer documents.

BranchesTags
Open more actions menu

Latest commit

 

History

103 Commits
103 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
assets
assets
 
 
benchmark
benchmark
 
 
kiri_ocr
kiri_ocr
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

Kiri OCR šŸ“„

PyPI version License Python Versions Downloads Hugging Face Model Hugging Face Spaces

Kiri OCR is a lightweight OCR library for English and Khmer documents. It provides document-level text detection, recognition, and rendering capabilities.

šŸš€ Try the Live Demo | šŸ“š Full Documentation

Kiri OCR

✨ Key Features

  • High Accuracy: Transformer model with hybrid CTC + attention decoder
  • Bi-lingual: Native support for English and Khmer (and mixed text)
  • Document Processing: Automatic text line and word detection
  • Streaming: Real-time character-by-character output (like LLM streaming)
  • Easy to Use: Simple Python API and CLI

šŸ“¦ Installation

pip install kiri-ocr

šŸ’» Quick Start

CLI Tool

kiri-ocr document.jpg

Python API

from kiri_ocr import OCR

# Initialize (auto-downloads from Hugging Face)
ocr = OCR()

# Extract text from document
text, results = ocr.extract_text('document.jpg')
print(text)

# Get detailed box-by-box results
for line in results:
    print(f"{line['text']} (confidence: {line['confidence']:.1%})")

Decoding Methods

Choose the decoding method based on your speed/quality tradeoff:

# Fast (CTC) - Fastest, good for batch processing
ocr = OCR(decode_method="fast")

# Accurate (Decoder) - Balanced speed and quality (default)
ocr = OCR(decode_method="accurate")

# Beam Search - Best quality, slowest
ocr = OCR(decode_method="beam")

Streaming Recognition

Get character-by-character output like LLM streaming:

from kiri_ocr import OCR

ocr = OCR(decode_method="accurate")

# Stream characters as they're decoded
for chunk in ocr.extract_text_stream_chars('document.jpg'):
    print(chunk['token'], end='', flush=True)
    if chunk['document_finished']:
        print()  # Done!

šŸ“š Documentation

Full documentation is available on the Wiki:

  • Installation
  • Quick Start Guide
  • Python API Reference
  • CLI Reference
  • Training Guide
  • Detector API
  • Architecture

šŸ“Š Benchmark

Results on synthetic test images (10 popular fonts):

Benchmark Graph

šŸ“ Project Structure

kiri_ocr/
ā”œā”€ā”€ core.py               # OCR class
ā”œā”€ā”€ model.py              # Transformer model
ā”œā”€ā”€ training.py           # Training code
ā”œā”€ā”€ cli.py                # Command-line interface
└── detector/             # Text detection
    ā”œā”€ā”€ db/               # DB detector
    └── craft/            # CRAFT detector

ā˜• Support

If you find this project useful:

  • ⭐ Star this repository
  • Buy Me a Coffee
  • ABA Payway

Join our Discord Community](https://discord.gg/Vcrw274RVC)

āš–ļø License

Apache License 2.0

About

Kiri OCR is a lightweight, OCR library for English and Khmer documents.

blizzer.tech

Topics

aikhmerkhmerocrocr

Resources

Readme
Apache-2.0 license
Activity

Stars

42 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.