Nodes/comfyui-dsocr-bbox/DeepSeek OCR Expand Subset BBox (Paste Text)
ComfyUI Node

DeepSeek OCR Expand Subset BBox (Paste Text)

Paste two OCR results

By maomaozi·Created 2 months ago·Updated 2 months ago· 0
DeepSeek OCR Expand Subset BBox (Paste Text)
  • image
  • ocr_result
ocr_result_a
ocr_result_b
image_width0
image_height0
coord_base1000
max_expand100
safety_margin0
ignore_empty_labeltrue
output_coord_base-1

This is DeepSeek OCR Expand Subset BBox with the inputs swapped from sockets to multiline textboxes. Same algorithm, same single ocr_result output, same "expand B up to max_expand while avoiding protected A - B" behavior - but ocr_result_a and ocr_result_b are now boxes you paste into.

It's a thin variant, so there isn't a lot of new mechanism to explain. Its reason to exist is debugging and one-off work: grab a full OCR result and a subset from whatever produced them, paste both in, and see how expansion behaves with real data before you wire the socket version into a pipeline. If you're iterating on max_expand and safety_margin values, this is the faster place to do it - no need to build the chain first.

What's here

Every input from the socket version is present and identical: image_width/image_height (with the optional image auto-size fallback), coord_base (default 1000), max_expand (default 100), safety_margin, ignore_empty_label (default on), and output_coord_base (-1 keeps the input base). Output is the single ocr_result string with B's bboxes replaced by their expanded versions, in the original <|ref|>/<|det|> format.

The one real caveat is the same as every paste-box variant in this pack: it doesn't react to changes. Your input is static text, so re-running is on you. That's exactly what you want for a scratchpad and not what you want for production - hence the socket sibling.

Installing

ComfyUI Manager (search "dsocr") or:

cd ComfyUI/custom_nodes
git clone https://github.com/maomaozi/comfyui-dsocr-bbox

then restart ComfyUI and install the pack requirements if the local-OCR nodes need them:

pip install -r custom_nodes/comfyui-dsocr-bbox/requirements.txt

Gotchas

Watch the A/B polarity - B expands, A - B is protected, and it's easy to paste them reversed. And keep both pasted results in the same coordinate base; if one is normalized and the other isn't, the geometry silently stops making sense. Blank labels in A won't block expansion as long as ignore_empty_label stays on, which is the behavior you almost always want.

CategoryDeepSeek OCR

Inputs (10)

NameTypeDefaultDescription
ocr_result_aSTRING
ocr_result_bSTRING
image_widthINT00–100000
image_heightINT00–100000
coord_baseINT10000–100000
max_expandINT1000–10000
safety_marginINT00–10000
ignore_empty_labelBOOLEANtrue
output_coord_baseINT-1-1–100000
imageoptIMAGE

Outputs (1)

NameTypeDescription
ocr_resultSTRING