PP-OCRv5_server_rec outputs only zeros for Chinese text on Apple Silicon (ARM64) CPU
Bug (问题描述)
Chinese text recognition model PP-OCRv5_server_rec outputs only 0000... on Apple Silicon (ARM64) CPU. English recognition (en_PP-OCRv5_mobile_rec) works correctly on the same machine.
♂️ Environment (运行环境)
| Component | Value |
|---|---|
| OS | macOS 25.5.0 (Darwin) on Apple Silicon (ARM64) |
| Python | 3.9 |
| PaddleOCR | 3.5.0 / 3.4.1 (both affected) |
| PaddlePaddle | 3.3.1 |
| PaddleX | 3.5.2 / 3.4.3 |
| Device | CPU (Apple Silicon, no GPU/MPS) |
Minimal Reproducible Example (最小可复现问题的Demo)
from PIL import Image, ImageDraw, ImageFont
from paddleocr import PaddleOCR
# Create a simple test image with Chinese text
img = Image.new('RGB', (1200, 150), color='white')
draw = ImageDraw.Draw(img)
font = ImageFont.truetype('/System/Library/Fonts/PingFang.ttc', 64)
draw.text((50, 30), '测试中文识别', fill='black', font=font)
draw.text((50, 95), 'OpenClaw OCR Test', fill='black', font=font)
img.save('/tmp/test_ocr.png')
# Test with doc_preprocessor disabled (to allow detection to work)
ocr = PaddleOCR(
lang='ch',
use_doc_orientation_classify=False,
use_doc_unwarping=False,
use_textline_orientation=False,
)
result = list(ocr.predict('/tmp/test_ocr.png'))
for r in result:
for t, s in zip(r.get('rec_texts', []), r.get('rec_scores', [])):
print(f"score={s:.4f} -> '{t}'")
Expected Output (预期输出)
score=0.XXXX -> '测试中文识别'
score=0.XXXX -> 'OpenClaw OCR Test'
Actual Output (实际输出)
score=0.8123 -> '000000'
score=0.9886 -> 'OpenClaw OCR Test'
Additional Findings (附加发现)
Detection works, recognition fails: The detection model
PP-OCRv5_server_detcorrectly locates 2 text regions. The Chinese region is detected, butPP-OCRv5_server_recoutputs only0s.English works fine: On the same image, English text "OpenClaw OCR Test" is recognized correctly with score 0.9886.
Model weights are correct: The character dictionary has 18,383 Chinese characters and includes all test characters. The issue is in the CTC decoding step.
Reinstall doesn't help: Uninstalling and reinstalling paddleocr/paddlepaddle/paddlex doesn't fix the issue. Deleting and re-downloading model weights also doesn't help.
v3.4.1 also affected: Downgrading to PaddleOCR 3.4.1 loads the same
PP-OCRv5_server_recmodel and has the same bug.Root cause hypothesis: The CTC label decoder's argmax output is all zeros on Apple Silicon CPU. The raw model output tensor appears to be either all zeros or has argmax always at index 0 (which is a blank/space character in the CTC dict). This may be related to MKL-DNN or OneDNN backend issues on ARM64.
Diagnostic code:
# The CTC character dict: index 0 = 'blank' (U+3000), index 1 = '一'
# All argmax results are 0, meaning the model outputs are maximized at index 0
# This produces '000000...' because '0' is at index 16162, but argmax is 0
Related Issues (相关Issue)
- #15603 - PP-OCRv5 detection regression on tightly cropped images
- #15551 - Multi Language support questions for PaddleOCR 3.0
Please let me know if you need additional diagnostic information. Happy to help debug.
Source: PaddlePaddle/PaddleOCR