KaptchaOCR ft-tiny: text CAPTCHA reader
Give it a text CAPTCHA image; it returns the characters in it: letters, digits and simple sums like 5+?=8.
It is a 4.3 MB ONNX model that reads one image in about 9.8 ms on a laptop CPU.
It is the smallest and fastest: for high volume or small devices, when about 2 in 3 exact reads is enough. The model is one part of KaptchaOCR, a Rust library and HTTP server that prepares the image, runs the model and turns its output into text.
Which model should I use?
All three readers were fine-tuned on the same data and differ only in size.
| Model | Preset | Size | Whole CAPTCHA right | Characters right | Time per image |
|---|---|---|---|---|---|
ft-tiny (this model) | fast | 4.3 MB | 67.0% | 88.8% | 9.8 ms |
ft-small | balanced | 20 MB | 80.4% | 93.0% | 28 ms |
ft-medium | accurate | 73 MB | 90.7% | 96.0% | 69 ms |
Scores are on 4,399 held-out CAPTCHA images; time is the mean on an Intel i5-1145G7 laptop CPU, one process. "Whole CAPTCHA right" means every character matches, including upper/lower case.
How well it works
On known CAPTCHA styles. The test images were never used in training, but they come from the same six public sources as the training images (named by codename). Exact match per source:
| Source | Exact |
|---|---|
atlas | 52% |
birch | 88% |
cobalt | 95% |
dune | 42% |
ember | 58% |
fjord | 94% |
| All 4,399 images | 67.0% |
On new CAPTCHA styles. Not measured for ft-tiny. ft-small drops to 39–64% exact on generators it never saw, so expect ft-tiny to be lower than that. Normalizing case helps: about half of the errors are upper/lower case only.
Use it
The easiest way is the KaptchaOCR server, which already includes this model:
# preset `fast` selects this model
kaptchaocr --ocr --manifest model/models.json --profile fast
Then send an image over HTTP, or use the Python client:
from kaptchaocr import Client
client = Client("http://127.0.0.1:8000")
answer = client.solve(open("captcha.png", "rb").read())
print(answer.text)
To use the files from this repo directly (non-inline build), keep the charset next to the model with the same base name:
kaptchaocr --ocr --ocr-path tiny_rec.onnx # reads tiny_rec.json from the same folder
Model list entry: {"name": "ft-tiny", "task": "rec", "path": "tiny_rec.onnx", "charset": "tiny_rec.json"}
Technical details
| Files | tiny_rec.onnx (model), tiny_rec.json (charset) |
| Base model | PP-OCRv6 tiny recognizer (PaddleOCR) |
| How it reads | CTC: the model scores every character at each horizontal position; KaptchaOCR merges repeats and removes blanks to get the text |
| Input | RGB image resized to 48 px high; any width |
| Output vocabulary | 6,906 characters, listed in tiny_rec.json and kept from the base model. The training labels use 73 of them (case-sensitive letters, digits and a few symbols) |
| Training data | zaltahir/kaptchaocr-rec: 169,311 images, some shown more than once (194,355 training rows) |
| Validation | 5,000 images |
Limitations
- New styles are harder (see above). Retraining on the new style is the fix; none is included here.
- Math: the training labels contain no
- * / × ÷, so subtraction, multiplication and division are often misread. KaptchaOCR's math solver refuses to answer when it finds no operator, but the raw text is still returned. - Only reads text. It does not solve picture CAPTCHAs ("click all the cars").
License
Apache-2.0. Fine-tuned from PP-OCRv6 (PaddleOCR, Apache-2.0).
Links
- KaptchaOCR on GitHub: the library, server, CLI and Python client
- All KaptchaOCR models and datasets
- Full benchmark: method, tables, charts