Private OCR project for Arabic document processing. All experiments and model evaluations are tracked here.
Python
0
5 commits
updated Feb 18, 2026
Local and private OCR system for extracting text from Arabic documents using local models. All processing runs 100% locally — no data is ever sent to any external server.
testing_ocr/
├── main.py # CLI runner for OCR experiments
├── handwriting_pipeline.py # Handwriting detection pipeline
├── test_easyocr.py # EasyOCR basic test
├── test_easyocr_enhanced.py # EasyOCR with preprocessing comparison
├── test_lightonocr.py # LightOnOCR test
├── test_qari.py # Qari-OCR test (Colab)
├── README.md
├── requirements.txt
├── config/
│ ├── __init__.py
│ └── settings.py
├── src/
│ ├── __init__.py
│ ├── ocr_engine.py # Unified OCR engine (4 models)
│ ├── preprocessor.py # Image preprocessing (7 methods)
│ ├── handwriting_detector.py # YOLOv8 handwriting detection
│ └── wakala_parser.py
├── files/ # Test documents (not on GitHub)
├── output/ # Results (not on GitHub)
└── tests/
| # | Model | Size | Platform | Doc Type | Avg Conf / Score | Result |
|---|---|---|---|---|---|---|
| 1A | LightOnOCR-2-1B | 1B | CPU local | Electronic | 6/10 | Good structure, weak Arabic words |
| 1B | LightOnOCR-2-1B (denoise) | 1B | CPU local | Electronic | 5.5/10 | Preprocessing didn't help |
| 2A | Qari-OCR v0.3 (4bit) | 2B | Colab T4 | Electronic | 5/10 | Better Arabic, missing data |
| 2B | Qari-OCR v0.3 (new prompt) | 2B | Colab T4 | Electronic | FAIL | Infinite looping |
| 2C | Qwen2-VL-2B (base) | 2B | Colab T4 | Electronic | FAIL | Refused to read |
| 2D | Qwen2-VL-2B (English prompt) | 2B | Colab T4 | Electronic | 3/10 | Read backwards, no HW separation |
| 2E | Qwen2-VL-2B (structured) | 2B | Colab T4 | Electronic | FAIL | Hallucinated fake content |
| 3 | Arabic-English-handwritten-OCR-v3 | 3B | Demo | Handwritten | FAIL | Infinite looping |
| 4 | YOLOv8n (detection only) | Small | CPU local | Handwritten | 4/10 | Found signatures only |
| 5 | Color separation (CV) | - | Colab | Handwritten | FAIL | Colors too similar |
| 6 | Stroke analysis (CV) | - | Colab | Handwritten | 5/10 | Found signatures/stamps only |
| 7A | EasyOCR (original) | Light | CPU local | Electronic | 75.0% conf | Good Arabic, broken numbers |
| 7B | EasyOCR (full preprocess) | Light | CPU local | Electronic | 76.1% conf | Best with full pipeline |
| 7C | EasyOCR (original) | Light | CPU local | Handwritten | 15.6% conf | FAIL on handwriting |
| Method | Detections | Avg Conf% | High Conf (>50%) | Time(s) |
|---|---|---|---|---|
| original | 72 | 75.0 | 63 | 122.1 |
| contrast | 71 | 74.4 | 62 | 119.9 |
| denoise | 70 | 75.3 | 61 | 109.7 |
| sharpen | 73 | 74.3 | 61 | 103.9 |
| binary | 67 | 76.3 | 55 | 126.4 |
| full | 73 | 76.1 | 64 | 106.2 |
Best method: full (denoise → CLAHE → sharpen → Otsu threshold)
# Create environment
conda create -n test_ocr python=3.11
conda activate test_ocr
# Install dependencies
pip install easyocr
pip install torch torchvision
pip install git+https://github.com/huggingface/transformers
pip install pypdfium2 Pillow opencv-python numpy
pip install ultralytics huggingface_hub
# Run EasyOCR test
python test_easyocr_enhanced.py
# Run handwriting detection
python handwriting_pipeline.py --file "files/doc.pdf" --confidence 0.6 --save
files/ are confidential — never upload to GitPrivate OCR project for Arabic document processing. All experiments and model evaluations are tracked here.
Python
0
5 commits
updated Feb 18, 2026
Local and private OCR system for extracting text from Arabic documents using local models. All processing runs 100% locally — no data is ever sent to any external server.
testing_ocr/
├── main.py # CLI runner for OCR experiments
├── handwriting_pipeline.py # Handwriting detection pipeline
├── test_easyocr.py # EasyOCR basic test
├── test_easyocr_enhanced.py # EasyOCR with preprocessing comparison
├── test_lightonocr.py # LightOnOCR test
├── test_qari.py # Qari-OCR test (Colab)
├── README.md
├── requirements.txt
├── config/
│ ├── __init__.py
│ └── settings.py
├── src/
│ ├── __init__.py
│ ├── ocr_engine.py # Unified OCR engine (4 models)
│ ├── preprocessor.py # Image preprocessing (7 methods)
│ ├── handwriting_detector.py # YOLOv8 handwriting detection
│ └── wakala_parser.py
├── files/ # Test documents (not on GitHub)
├── output/ # Results (not on GitHub)
└── tests/
| # | Model | Size | Platform | Doc Type | Avg Conf / Score | Result |
|---|---|---|---|---|---|---|
| 1A | LightOnOCR-2-1B | 1B | CPU local | Electronic | 6/10 | Good structure, weak Arabic words |
| 1B | LightOnOCR-2-1B (denoise) | 1B | CPU local | Electronic | 5.5/10 | Preprocessing didn't help |
| 2A | Qari-OCR v0.3 (4bit) | 2B | Colab T4 | Electronic | 5/10 | Better Arabic, missing data |
| 2B | Qari-OCR v0.3 (new prompt) | 2B | Colab T4 | Electronic | FAIL | Infinite looping |
| 2C | Qwen2-VL-2B (base) | 2B | Colab T4 | Electronic | FAIL | Refused to read |
| 2D | Qwen2-VL-2B (English prompt) | 2B | Colab T4 | Electronic | 3/10 | Read backwards, no HW separation |
| 2E | Qwen2-VL-2B (structured) | 2B | Colab T4 | Electronic | FAIL | Hallucinated fake content |
| 3 | Arabic-English-handwritten-OCR-v3 | 3B | Demo | Handwritten | FAIL | Infinite looping |
| 4 | YOLOv8n (detection only) | Small | CPU local | Handwritten | 4/10 | Found signatures only |
| 5 | Color separation (CV) | - | Colab | Handwritten | FAIL | Colors too similar |
| 6 | Stroke analysis (CV) | - | Colab | Handwritten | 5/10 | Found signatures/stamps only |
| 7A | EasyOCR (original) | Light | CPU local | Electronic | 75.0% conf | Good Arabic, broken numbers |
| 7B | EasyOCR (full preprocess) | Light | CPU local | Electronic | 76.1% conf | Best with full pipeline |
| 7C | EasyOCR (original) | Light | CPU local | Handwritten | 15.6% conf | FAIL on handwriting |
| Method | Detections | Avg Conf% | High Conf (>50%) | Time(s) |
|---|---|---|---|---|
| original | 72 | 75.0 | 63 | 122.1 |
| contrast | 71 | 74.4 | 62 | 119.9 |
| denoise | 70 | 75.3 | 61 | 109.7 |
| sharpen | 73 | 74.3 | 61 | 103.9 |
| binary | 67 | 76.3 | 55 | 126.4 |
| full | 73 | 76.1 | 64 | 106.2 |
Best method: full (denoise → CLAHE → sharpen → Otsu threshold)
# Create environment
conda create -n test_ocr python=3.11
conda activate test_ocr
# Install dependencies
pip install easyocr
pip install torch torchvision
pip install git+https://github.com/huggingface/transformers
pip install pypdfium2 Pillow opencv-python numpy
pip install ultralytics huggingface_hub
# Run EasyOCR test
python test_easyocr_enhanced.py
# Run handwriting detection
python handwriting_pipeline.py --file "files/doc.pdf" --confidence 0.6 --save
files/ are confidential — never upload to Git