Reference
Custom OCR Models
Point Shotori at your own ONNX detection, orientation, and recognition models with a rapidocr-core TOML configuration.
In addition to Shotori’s 6 bundled PP-OCR presets, you can run your own fine-tuned ONNX detector, community recognizer, or custom character dictionary by configuring a rapidocr-core pipeline file.
Enabling a Custom Config
Open shotori settings ocr → Custom model:
- New from template… — Generates a complete, ready-to-edit TOML file pre-populated with the active model’s exact thresholds, normalization
mean/std, and tensor shapes. Simply pointmodel_pathanddict_pathat your own files. - Choose file… — Activates an existing
.tomlconfiguration immediately. - Open config / Clear — Edit the active TOML in your system editor, or clear it to return to bundled models.
Or set it directly in ~/.config/shotori/settings.toml (close shotori settings first before hand-editing):
[ocr]
custom_config = "~/models/my-ocr.toml"
While custom_config is set, it overrides ocr.model completely and never triggers network downloads.
Pipeline TOML Format
Top-level scalar thresholds must appear before any [section] header:
# Required top-level pipeline knobs
text_score = 0.5
min_side_len = 30
max_side_len = 2000
min_height = 30
width_height_ratio = 8.0 # -1.0 disables the ratio gate
[pipeline]
use_det = true
use_cls = false
use_rec = true
[det]
model_path = "det.onnx"
limit_side_len = 960
limit_type = "Max" # "Max" | "Min"
mean = [0.485, 0.456, 0.406]
std = [0.229, 0.224, 0.225]
thresh = 0.3
box_thresh = 0.6
max_candidates = 1000
unclip_ratio = 1.6
min_size = 3
[rec]
model_path = "rec.onnx"
dict_path = "dict.txt" # One token/character per line
image_shape = [3, 48, 320]
batch_size = 16
Path Resolution & Validation Rules
- Stage sections: A section (
[det],[cls],[rec]) is required if and only if its correspondinguse_*flag istrue. For recognition-only crops (use_det = false,use_rec = true), only[rec]is needed. - Relative paths: Paths starting with
~expand against$HOME. Relative model/dictionary paths resolve relative to the directory containing the TOML file — never the arbitrary working directory of a keybind-spawned process. - Live diagnostics: If a file is missing or TOML syntax fails validation,
shotori settings ocrand desktop notifications reportUnusable: <exact reason>.