Tesseract LSTM OCR โ GGUF models for CrispEmbed
Tesseract's LSTM line-recognition engine converted to GGUF format for CrispEmbed inference. Supports 12 languages with models ranging from 250 KB to 3.2 MB.
These are the neural network weights from tessdata_best (float64 source), converted with full precision then quantized. The LSTM recognizes pre-cropped text line images โ pair with a text detector (DBNet, Surya) for full-page OCR.
Models
| Language | Code | Params | F16 | Q8_0 | Q4_K | VGSL topology |
|---|---|---|---|---|---|---|
| English | eng | 1.46M | 2.9 MB | 1.5 MB | 857 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| German | deu | 940K | 1.8 MB | 976 KB | 537 KB | Lfys64 Lfx96 Lrx96 Lfx384 |
| French | fra | 391K | 769 KB | 435 KB | 270 KB | Lfys48 Lfx96 Lrx96 Lfx192 |
| Spanish | spa | 1.46M | 2.9 MB | 1.5 MB | 853 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| Italian | ita | 822K | 1.6 MB | 860 KB | 481 KB | Lfys64 Lfx64 Lrx64 Lfx384 |
| Portuguese | por | 822K | 1.6 MB | 860 KB | 481 KB | Lfys64 Lfx64 Lrx64 Lfx384 |
| Dutch | nld | 408K | 801 KB | 449 KB | 247 KB | Lfys64 Lfx96 Lrx96 Lfx192 |
| Russian | rus | 1.47M | 2.9 MB | 1.5 MB | 860 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| Arabic | ara | 1.45M | 2.8 MB | 1.5 MB | 848 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| Chinese (Simplified) | chi_sim | 1.52M | 3.1 MB | 1.6 MB | 900 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| Japanese | jpn | 1.62M | 3.2 MB | 1.7 MB | 952 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
| Korean | kor | 1.48M | 2.9 MB | 1.5 MB | 863 KB | Lfys64 Lfx96 Lrx96 Lfx512 |
Quantization quality
Tested with crispembed-diff per-layer parity harness against F16 Python reference:
| Quantization | Cosine similarity (worst layer) | Text output | Recommendation |
|---|---|---|---|
| F16 | 1.000000 | Perfect match | Best quality, 2x size of F32 |
| Q8_0 | 0.9994+ | Identical to F16 | Recommended โ no text degradation |
| Q4_K | 0.92-0.99 | Core text correct, minor edge artifacts | Smallest size, acceptable for most uses |
Usage
CLI
crispembed -m tesseract-eng-q8_0.gguf --ocr image.png
C API
#include "tesseract_lstm.h"
tesseract_lstm_context *ctx = tesseract_lstm_init("tesseract-eng-q8_0.gguf", 4);
const char *text = tesseract_lstm_recognize(ctx, gray_pixels, width, height, NULL);
printf("%s\n", text);
tesseract_lstm_free(ctx);
Unified OCR API (auto-detects architecture)
void *ctx = crispembed_math_ocr_init("tesseract-eng-q8_0.gguf", 4);
const char *text = crispembed_math_ocr_recognize(ctx, pixels, w, h, channels, NULL);
crispembed_math_ocr_free(ctx);
Architecture
The VGSL (Variable-size Graph Specification Language) network:
Input (grayscale, height-normalized)
-> Convolve 3x3 stacking (no weights, just neighborhood concat)
-> FullyConnected + tanh (9 -> 16 features)
-> MaxPool 3x3
-> XYTranspose + SummLSTM (summarize height dimension)
-> LSTM forward (96 or 64 units)
-> LSTM reverse (96 or 64 units)
-> LSTM forward (192-512 units)
-> Softmax output
-> CTC greedy decode
Spaces are not produced by the LSTM โ Tesseract adds them via its DAWG language model (word segmentation), which is not part of this engine. Use the output as character-level recognition and add word boundaries via the text detector's bounding boxes.
Conversion
Convert any of the 126 Tesseract languages from .traineddata:
python models/convert-tesseract-to-gguf.py \
--model eng.traineddata --output tesseract-eng-f16.gguf --fp16
# Then quantize:
crispembed-quantize tesseract-eng-f16.gguf tesseract-eng-q8_0.gguf q8_0
crispembed-quantize tesseract-eng-f16.gguf tesseract-eng-q4_k.gguf q4_k
Supports both tessdata_best (float64, recommended) and tessdata_fast (int8).
Source
Weights from tesseract-ocr/tessdata_best (Apache-2.0 license). Converted with CrispEmbed's convert-tesseract-to-gguf.py.
- Downloads last month
- 1,561
8-bit
16-bit