FlanChanXwO/phpwind-captcha-ocr
PHPWind Captcha OCR
   
An ONNX OCR model trained on four-digit numeric captcha images from one legacy PHPWind deployment. It runs entirely on the local machine: no external API or GPU is required.
PHPWind reference implementation: alibaba/phpwind contains the PwVerifyCode and PwGDCode classes targeted by this model.
中文文档: README_zh.md
Answer for the captcha shown above: 9125Scope and responsible use
This model is intended for PHPWind site operators, developers, and researchers working with PHPWind deployments they own or are explicitly authorized to test. Use it for local integration tests, accessibility research, or evaluation of your own captcha implementation. Do not use it to automate account logins or bypass access controls.
Different PHPWind versions and custom themes can generate visually different captchas. Validate on representative, authorized samples before deployment.
Version support
This checkpoint was trained only on four-digit captcha images from a target deployment whose footer displayed v0.7β. This is an observed deployment label, not a claim about an official PHPWind release version.
Quick start
Install the runtime:
pip install onnxruntime pillow numpyRun local inference on a captcha image you are authorized to process:
import numpy as np
import onnxruntime as ort
from PIL import Image
session = ort.InferenceSession("model.onnx", providers=["CPUExecutionProvider"])
def predict_captcha(path: str) -> str:
image = Image.open(path).convert("RGB").resize((160, 64), Image.BILINEAR)
inputs = np.asarray(image, dtype=np.float32).transpose(2, 0, 1)[None] / 255.0
logits = session.run(None, {"input": inputs})[0]
return "".join(str(int(logits[0, position].argmax())) for position in range(4))
print(predict_captcha("captcha.png"))Model interface
Evaluation
The published checkpoint reached 88.61% validation accuracy on a held-out split of 997 manually labelled images from the target v0.7β footer-label deployment. This is a model-card reference metric, not a guarantee for another PHPWind version, theme, or deployment. See the evaluation protocol for the scope and reproducibility requirements.
Documentation
- Inference guide — Python and Go integration details
- Training and fine-tuning — data preparation and model training
- Evaluation — offline validation protocol
- Documentation index
Training data and license
The checkpoint was trained from scratch with a position-preserving CNN on 997 manually labelled images. For adaptation, use only captcha images from PHPWind deployments you operate or are authorized to evaluate.
This project is licensed under GNU AGPL-3.0. Modified or networked derivative works must meet the license's corresponding-source requirements.
