File size: 1,766 Bytes
2af6ae7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Bina 0.2 Rizeh: quick start / راه‌اندازی سریع

This repository includes both the Persian recognizer and the PP-OCRv6 Medium detector, so the commands below do not download model weights at runtime.

این مخزن هم مدل تشخیص متن فارسی و هم آشکارساز PP-OCRv6 Medium را دارد؛ بنابراین هنگام اجرا وزن دیگری دانلود نمی‌شود.

## Install / نصب

```bash
git lfs install
git clone https://huggingface.co/Reza2kn/Bina-0.2-Rizeh
cd Bina-0.2-Rizeh
python -m pip install "paddlepaddle>=3.2,<4" "paddleocr>=3.3,<4"
```

The command above installs CPU PaddlePaddle. For NVIDIA GPUs, install the PaddlePaddle GPU wheel matching your CUDA version first, then install `paddleocr>=3.3,<4`.

دستور بالا نسخه CPU را نصب می‌کند. برای کارت NVIDIA ابتدا نسخه GPU سازگار با CUDA خود را نصب کنید و سپس PaddleOCR را نصب کنید.

## Full page / صفحه کامل

```bash
python bina_page_ocr.py page.jpg --device cpu --output result.json
# NVIDIA example:
python bina_page_ocr.py page.jpg --device gpu:0 --output result.json
```

Images and PDFs are accepted. Output is UTF-8 JSON containing page text, logical-order Persian lines, confidence scores, and boxes.

## Line crops / برش خط

```bash
python bina_text_recognition.py line.jpg --device cpu
```

Python:

```python
from bina_text_recognition import BinaTextRecognition
model = BinaTextRecognition(device="cpu")
for row in model.predict("line.jpg"):
    print(row["text"], row["score"])
```

## Paths / مسیرها

- Recognizer: `inference/`
- Bundled detector: `detector/`
- Best training checkpoint: `checkpoint/`
- Exact benchmark evidence: `benchmark/`