ONNX - NDL

Model FP32 Task
PARSeq-tiny parseq-tiny_30.onnx, parseq-tiny_50.onnx, parseq-tiny_100.onnx text recognition (Japanese, vertical and horizontal lines)

Usage

# onnxruntime-gpu for run it on GPU
pip install onnxruntime opencv-python numpy

Every model folder has the same layout:

  • src/helper.py = onnx session builder (provider selection, threads, memory options)
  • src/example.py = full pipeline: image preprocess, inference, postprocess
  • onnx/ = the model file

Run the commands from the repository root.

Test images used by the examples:

PARSeq-tiny

python3 PARSeq-tiny/src/example.py jp_vert_1.jpg
0.997674 | ๆ—ฅๆœฌ่ชžใฎ็ธฆๆ›ธใใ‚’ๆ–‡ๅญ—
0.999972 | ่ช่ญ˜ใงใใ‚‹ใ‹ใฉใ†ใ‹ใฎ
0.999093 | ใƒ†ใ‚นใƒˆใ€‚

Note:

  • Input = a single text line, laid horizontally: a vertical column is rotated 90 degrees counter-clockwise first
    (the characters lie on their side, that is how the model was trained).
  • The example reads an image wider than tall as one line. An image taller than wide is taken as a vertical text block:
    split into columns on the blank gaps, read from right to left.
  • Input = RGB image resized to the model size without keeping the aspect ratio, scaled to -1..1, CHW with batch dimension.
  • Three models, same network, different line length:
    parseq-tiny_30.onnx = [1, 3, 24, 256], up to 30 characters;
    parseq-tiny_50.onnx = [1, 3, 24, 384], up to 50 characters;
    parseq-tiny_100.onnx = [1, 3, 24, 768], up to 100 characters.
  • Model choice = start from the shortest one, skip it when the line is too long for it (width / height over its
    character count minus 5), read again with the next one when the text fills it.
  • Output = [1, count + 1, 7142] raw logits, one row per character: argmax per row, stop at index 0 (end of text).
  • Character map = index 0 is the end of text, 1..7141 are the lines of
    PARSeq-tiny/onnx/dictionary.txt.
  • Score = mean of the softmax probability of the kept characters.
  • onnxruntime prints many ScatterND warnings when these models are loaded: the example silences them with
    onnxruntime.set_default_logger_severity(3).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support