Nodes/Vevor Mask Union/OCR · PaddleOCR → JSON+mask (no registry JSON node yet)
ComfyUI Node

OCR · PaddleOCR → JSON+mask (no registry JSON node yet)

PaddleOCR Without A Cloud Key

By rexqin·Created about a month ago·Updated 19 days ago· 0
OCR · PaddleOCR → JSON+mask (no registry JSON node yet)
  • image
  • ocr_json
  • mask
◄langen►
◄use_gputrue►

OCR is the unglamorous first step of every "change the text on this image" workflow, and it's usually where the pipeline dies. You either pay a cloud OCR API per image, or you bolt on a separate script and lose the graph. VevorOcrPaddle runs PaddleOCR on your own machine, inside the graph, and hands you back the two things every downstream node actually wants: machine-readable text with boxes, and a mask of where that text sits.

What it is, and why it's shaped like this

This node exists because a translation pipeline needs geometry, not just text. Knowing the image says "62cc 3.8HP" is useless if you don't also know it's a 340-pixel-wide box at (210, 890) - you can't erase it, you can't re-render a German version inside it, and you can't tell the image model where to put the new glyphs.

So the node emits a labelme-format JSON document (shapes with pixel rectangles and the recognised string) plus a per-region MASK batch in the same shape an EasyOCR node produces. That second output is the important design decision: any node in this pipeline that consumed EasyOCR masks downstream works with PaddleOCR unchanged, because the contract is the batch layout, not the OCR engine.

The display name ends with "no registry JSON node yet", which is the author being honest: a JSON-typed socket has almost no core consumers. The things that eat this output are further down the same pack - VevorOcrGuard (which classifies regions as translate / render / protect-brand / noise) and VevorTextRender (which draws the translated string into the original box with a real font file). If you're expecting to plug the JSON into a core node, there isn't one.

Inputs and outputs

Three inputs, and only one of them will ever bite you.

  • image - an IMAGE. Only frame 0 is used. If you feed a batch of eight, you get OCR for the first one and silence about the other seven.
  • lang - enum of en, ch, chinese_cht, japan, korean. Pick the script, not the country.
  • use_gpu - default on. Turn it off if you're on CPU-only or fighting a CUDA mismatch.

Outputs are ocr_json (the labelme payload, as a one-document list) and mask (an (N, H, W) batch, one filled rectangle per detected region).

Because the mask is a batch, wire it through VevorMaskBatchUnion before you composite anything - otherwise a single-image composite quietly keeps only the first region. That trap is why the pack exists at all.

Install

The pack installs from ComfyUI Manager (search Vevor Mask Union) or:

cd ComfyUI/custom_nodes
git clone https://github.com/rexqin/comfyui-vevor-mask-union

But PaddleOCR is not a declared dependency - pyproject.toml lists none, deliberately, so the other thirty-odd nodes in this pack don't drag in a 2 GB paddle wheel. Install it into ComfyUI's Python, not your system one:

# find the interpreter ComfyUI is actually running
python -c "import sys; print(sys.executable)"
# then, with that interpreter
pip install paddlepaddle-gpu paddleocr
# CPU-only box:
pip install paddlepaddle paddleocr

Restart ComfyUI afterwards. If you skip the install, the node raises a clean PaddleOCR not installed in ComfyUI Python runtime error with that exact pip line in it - a rare courtesy, and a hint that the author hit this himself.

Where people get burned

The engine is cached per session, so lang sticks. The node builds one PaddleOCR instance on first run and reuses it for the rest of the session; the language is baked in at construction. Change lang from en to japan mid-session and you'll still get English behaviour until you restart ComfyUI. Annoying, invisible, easy to misdiagnose as bad OCR.

use_gpu is handled differently across PaddleOCR versions. The code tries the older use_gpu= keyword first and falls back to the newer device="gpu:0" constructor form. That fallback is why it works on both PaddleOCR 2.x and 3.x, but it also means "GPU on" doesn't guarantee you're on GPU - check the startup log for the device paddle actually picked.

Boxes are rectangles, not quads. PaddleOCR returns four-corner polygons; this node takes the min/max to make an axis-aligned box, and the mask is a filled rectangle. Fine for horizontal shelf labels, generous for slanted text on a lifestyle shot.

Low-confidence junk is not filtered. Every detection lands in the JSON with its score appended to the label (text:0.8712 format), including the nonsense PaddleOCR reads off a texture. Downstream filtering is VevorOcrGuard's job - the brand list, the number repair, dropping symbol-only debris. Don't expect this node to be tidy; expect it to be complete.

That's the trade: no API key, no per-image cost, no network, and your OCR runs at whatever speed your GPU happens to be. For a batch of product shots that's the right trade almost every time.

Categoryvevor/ocr

Inputs (3)

NameTypeDefaultDescription
imageIMAGE—
langCOMBOen5 options: en, ch, chinese_cht, japan, korean
use_gpuBOOLEANtrue—

Outputs (2)

NameTypeDescription
ocr_jsonJSON—
maskMASK—