Skip to content

OCR Inferencer Node ​

Overview ​

The OCR Inferencer node, registered as ocr (it appears as ocr in the palette), reads text in images with pretrained models: PaddleOCR (PP-OCRv3 to v6), PARSeq, SVTRv2 and the PaddleOCR-VL vision-language models. It runs on the same shared inference server as the inferencer node, a Docker container that the first inference node starts.

The models are pretrained only: the node does not use a Firebase connection and does not load models trained on the platform. Their weights are downloaded on first use into the OCR cache folder of the controller.

Key Features ​

  • Five tasks: full OCR (detection and recognition), detection only, recognition only, PaddleOCR-VL, and document rotation
  • Document preprocessing in the OCR task: unwarping, page orientation and text-line orientation
  • Text helpers: besides every box, the text of the largest box, of the most confident one and of the one nearest the centre
  • One slot per setup: OCR nodes with the same task, models and preprocessing share one model on the server; different setups do not interfere
  • Automatic warm-up after the model loads
  • Promise mode and a debug image, as in the inferencer node

Tasks ​

Task in the editorWhat it doesResult
OCR (Detection + Recognition) (default)Finds the text regions and reads each oneOne object: every text box, the joined text and the helpers
Detection OnlyFinds the text regionsA list of boxes
Recognition OnlyReads an image that is already a crop of one word or lineOne text and its confidence
VLM (PaddleOCR-VL)Detection and recognition with a PaddleOCR-VL modelSame as OCR
Document RotationClassifies the orientation of the pageThe angle

Configuration ​

Settings Tab ​

PropertyDefaultMeaning
NameocrLabel of the node; also the key of its timings in msg.performance.inference
Input fieldimagemsg property with the image or an array of images, in the formats of the inferencer
Output fieldinference.ocrmsg property that receives the result
TaskOCR (Detection + Recognition)One of the tasks above
VL modelPaddleOCR-VLVLM task only: PaddleOCR-VL, PaddleOCR-VL-1.5 or PaddleOCR-VL-1.6
PromiseoffSends the message at once with a promise of the result, as in the inferencer
Promises fieldpromisesmsg property, an array, that receives the promises
Show debug imageoffShows the image under the node with each text box outlined and captioned text: score
Debug interval / Debug image width1 / 160One message out of N; width of the picture in pixels
Box thickness / Font size2 / 0.51 to 10 / 0.3 to 2

The Restart Containers button, after a confirmation, reconnects the node to the inference server, starting it again if it does not answer, asks the server to load the node's slot again, and sends the node's preprocessing settings to the server again.

Advanced Settings Tab ​

PropertyDefaultMeaning
Maximum concurrent predictions5Predictions in progress at once, 1 to 40. A message beyond the limit fails with Maximum concurrent predictions limit (5) exceeded.

Below it, the JSON configuration form of the task chooses the models. The VLM task has no form, and Document Rotation has no fields. Restore default config goes back to the defaults.

FieldTasksValuesDefault in the form
det_modelOCR, DetectionPP-OCRv5_server_det, PP-OCRv5_mobile_det, PP-OCRv6_medium_det, PP-OCRv6_small_det, PP-OCRv6_tiny_det, PP-OCRv4_server_det, PP-OCRv4_mobile_det, PP-OCRv3_mobile_det, PP-OCRv3_server_detPP-OCRv5_server_det
rec_modelOCRPP-OCRv5_server_rec, PP-OCRv5_mobile_rec, PP-OCRv6_medium_rec, PP-OCRv6_small_rec, PP-OCRv6_tiny_rec, PP-OCRv4_server_rec_doc, PP-OCRv4_mobile_rec, PP-OCRv4_server_rec, en_PP-OCRv4_mobile_rec, SVTRv2-BPP-OCRv5_server_rec
rec_modelRecognitionThe same, plus the PARSeq models parseq, parseq-tiny and parseq-patch16-224PP-OCRv5_server_rec
use_doc_unwarpingOCRStraightens curved or photographed pagesoff
use_doc_orientation_classifyOCRDetects a page turned 90, 180 or 270 degrees and rotates it back before readingon
use_textline_orientationOCRDetects text lines upside down and turns themon
image_shapeDetection, RecognitionWidth and height the image is resized toempty

A node created without opening the dialog (for example imported from a file) starts with the three preprocessing options off.

The recognition models run on the PaddlePaddle backend, except PARSeq (PyTorch) and SVTRv2-B in the Recognition task (PyTorch, OpenOCR); in the OCR task SVTRv2-B replaces only the recognition stage of the PaddleOCR pipeline.

SVTRv2-B (OpenOCR, PyTorch) is the strongest model here on single words: 96.5 / 85.6 on the Common / Union14M-L scene-text benchmarks, vs 93.3 / 64.8 for PP-OCRv6_medium_rec. It is weaker on long lines (42 vs 52 on OpenOCR's long-text benchmark), and its charset is 94 ASCII characters with no space: a line like L70562 02/11/26 comes back as L7056202/11/26, and accents are dropped. In the OCR task it replaces only the recognition stage; detection and orientation stay PaddleOCR. Weights (80 MB) download on first use into the shared ocr_cache directory.

Input ​

javascript
msg.image = imageBuffer;   // a raw bitmap or a JPEG, PNG or WebP Buffer, or an array of them
return msg;

A message without an image in the Input field fails with The field msg.image must be an image or an array of images.

Warm-up ​

The node warms its model up by itself once it is loaded. To warm it up again, send either of:

javascript
msg.warmup = true;
msg.inferencerRequest = { type: "warmup" };

A warm-up message waits until the node is ready, runs one silent prediction on msg.image (or on msg.inferencerRequest.image, or on a synthetic image when there is none) and sends nothing. The node does not take loadModel or unloadModel requests: its model is set by its configuration, and a message with any request type other than warmup is processed as an ordinary prediction. To see or free what the server holds, use the model-manager node.

Output ​

The result goes to the Output field, msg.inference.ocr by default, and the timings to msg.performance.inference.<node name>, in the same shape as the inferencer. With an array of images, the result is an array in the same order. All coordinates are relative to the image, from 0 to 1.

OCR and VLM ​

javascript
{
  text: "LOT 4471\nEXP 02/27",
  texts: [
    { coords: [[0.12, 0.20], [0.48, 0.20], [0.48, 0.31], [0.12, 0.31]], text: "LOT 4471", score: 0.98 },
    { coords: [[0.12, 0.40], [0.52, 0.40], [0.52, 0.52], [0.12, 0.52]], text: "EXP 02/27", score: 0.95 }
  ],
  text_largest_box: "EXP 02/27",
  text_highest_score: "LOT 4471",
  text_most_centric: "EXP 02/27",
  text_concatenated: "LOT 4471\nEXP 02/27",
  metadata: { document_angle: 0, orientation_angles: [], warping_applied: false }
}
PropertyMeaning
textsOne entry per text box: its four corners coords (clockwise from the top left), the text read and its score (0 to 1)
text, text_concatenatedThe texts of all the boxes, joined
text_largest_boxText of the box with the largest area
text_highest_scoreText of the box with the highest score
text_most_centricText of the box nearest the centre of the image
metadata.document_angleRotation of the page detected by the page orientation stage, in degrees
metadata.orientation_anglesText-line orientation of each box, when that stage is on; empty otherwise
metadata.warping_appliedWhether unwarping was applied

Detection Only ​

A list of boxes in the detection shape of the inferencer: raw_boxes, confidence, classId and every box format.

Recognition Only ​

javascript
{ text: "AB-1234", confidence: 0.94 }

Document Rotation ​

javascript
{ angle: 90, orientation_label: "..." }   // label as the model names it

Errors and Status ​

A failed prediction still sends the message, with the error text in the Output field, and logs Prediction failed: <reason>, as described for the inferencer. The status texts are those of the inferencer while the server starts and the model loads, then green Ready, then the timings of the last prediction.

The Shared Server ​

The OCR node runs on the inference server described in Inferencer. Each OCR setup (task, models and preprocessing) is a separate slot on the server, identified by the backend name (PADDLE, PADDLEVL, PARSEQ or SVTRV2) and a variant of the form ocr:<task>:<hash>. That is how model-manager lists it. The slot is released 10 seconds after the node is stopped or removed, unless a node with the same setup takes it again meanwhile, and counts toward the server's MAX_LOADED_MODELS like any model.

Examples ​

Read a lot code and an expiry date ​

[camera] → [ocr: OCR, Output field ocr] → [function]
javascript
// Keep the confident boxes, top to bottom
const lines = msg.ocr.texts
  .filter(t => t.score >= 0.85)
  .sort((a, b) => a.coords[0][1] - b.coords[0][1])
  .map(t => t.text);
msg.payload = {
  lot: lines.find(l => l.startsWith("LOT")) || null,
  expiry: lines.find(l => l.startsWith("EXP")) || null
};
return msg;

Detect, crop, then read ​

Use a node with Detection Only to find the regions, crop them (for example with rp-cropBB of the Rosepetal image tools, which cuts one crop per box from the relative raw_boxes as they come, as long as the boxes are axis-aligned), and send the crops as an array to a node with Recognition Only. The result is one { text, confidence } per crop, in the same order.

See Also ​