Views
No views yet
captcha package. It replaces ten
per-site CNN classifiers with a single model that reads variable-length
alphanumeric strings from arbitrarily-sized input images.1from txtcaptcha import decrypt, read_captcha
2
3cap = read_captcha("captcha.png")
4# First call downloads the weights from this repo into ~/.cache/huggingface;
5# subsequent calls are free.
6print(decrypt(cap)) # greedy CTC decoding
7print(decrypt(cap, length=5)) # force exactly 5 output chars
8print(decrypt(cap, mask="[0-9]")) # restrict to digits1from txtcaptcha import from_pretrained
2model = from_pretrained("jtrecenti/txtcaptcha-crnn")txtcaptcha:pip install git+https://github.com/jtrecenti/txtcaptchacadesp, esaj, jucesp, rfb, sei, tjmg, tjpe, tjrs, trf5, trt<id>_<label>.<ext>. Vocabulary is
the full alphanumeric range 0-9a-zA-Z (62 classes + CTC blank).| Stage | Details |
|---|---|
| Backbone | ResNet-style CNN, channels 64 → 128 → 256 → 256, H/8 × W/4 downsample |
| Sequence head | 2-layer bidirectional LSTM, hidden 256 |
| Classifier | Linear 512 → 63 (62 chars + blank) |
| Loss | CTC, handles variable output length |
| Input | Any dimensions; height resized to 32 at inference, width preserved |
config.json.notebooks/eval_per_dataset.ipynb.sei dataset is a math captcha; the model learned to transcribe
the (already-solved) label as if it were a plain 4-char sequence.decrypt(..., length=N) to enforce an exact length.revision=:from_pretrained("jtrecenti/txtcaptcha-crnn", revision="v0.1.0")captcha package is redistributed
under its own terms.