DeepSeek OCR: Run
Turn a screenshot into clean Markdown — DeepSeek OCR's Run node does it locally
- model
- image
- text
- visualization
This is the node that actually does the work. Feed it the model handle from DeepSeek OCR: Load Model plus an image, and you get back clean text - or Markdown, or a parsed chart, or a list of where a specific object sits in the frame. It's the payoff node of the pack: Load is one-time setup, Run is what you'll re-use on every batch.
The realistic use cases are the ones that make ordinary OCR cry: multi-column scanned documents, tables with merged cells, figures with axis labels, watermarks and logos you want to find rather than read. Traditional OCR tools miss those or mangle them. DeepSeek-OCR is a vision-language model, so it reads the whole page with actual understanding, then writes what it saw.
How it works
Under the hood the Run node does a small pipeline: your ComfyUI IMAGE tensor becomes a PIL image (first frame if you feed a batch), gets saved to a temp PNG because DeepSeek-OCR's inference wants a file path, the node picks a resolution preset and builds a prompt for your task, and calls the model's infer(). It gets the text back directly, then - for the locate task - it draws boxes on your image and returns that as the second output.
The task list is just prompt templates under the hood, which is worth knowing when a task misbehaves: Convert to Markdown sends Convert the document to markdown. with grounding enabled, Parse Figure sends Parse the figure., Locate by Reference builds Locate <|ref|>your text<|/ref|> in the image. You can't see or edit the prompts, but knowing they exist explains a lot about why output looks the way it does.
Inputs - the three that matter
task-Free OCR,Convert to Markdown(default),Parse Figure,Locate by Reference. Pick before touching anything else; it changes both the prompt and what's useful in the output.resolution-Gundam(default),Tiny(512),Small(640),Base(1024),Large(1280). Gundam is the weird one and it's there for a reason: it uses a 1024 base with dynamic cropping and compression, tuned for long documents where you'd otherwise lose the edges. For a normal screenshot,Baseis the more predictable choice. Tiny/Small are your VRAM safety valves.output_type-all(default, text + image),text,image. Set it totextwhen you only care about the transcription,imagewhen you only want the annotated result.
The optional trio only matters for locate: reference_text (what to find, e.g. "price", "logo", "哆啦A梦"), box_color (a preset name like red/cyan, or a custom "255,105,180" RGB string), and box_width (1–10 px, default 2). For non-locate tasks you can ignore all three.
Outputs - and what they wire into
text(STRING) - the recognized text. Expect it to carry the model's markers, e.g....<|ref|>price<|/ref|><|det|>[[23,45,198,76]]<|/det|>.... Those[[x,y,x2,y2]]coordinates are normalized to a 0–999 space, not pixels - you don't parse them by hand, and they're only really interesting on the locate task anyway. Wire this into a Save Text / Display Text node, or straight into an LLM node for downstream summarization.visualization(IMAGE) - for the locate task, your original image with bounding boxes drawn in your chosen color and width. For every other task it's just the input image passed through, so don't be confused when it looks identical.
The canonical workflow is barely three nodes: LoadImage → DeepSeek OCR: Load Model → DeepSeek OCR: Run, with the text output going to a save node. The README's "document to Markdown" pattern is exactly that with task = Convert to Markdown, resolution = Gundam - screenshot or scan in, Markdown string out.
Installing and the gotchas
Install is the same as the whole pack (see the Load node page): ComfyUI Manager or git clone https://github.com/Geo1230/ComfyUI-DeepseekOCR into custom_nodes/, then pip install -r requirements.txt. The one pin that bites: on transformers 4.55+ the Load node errors, and the documented fix is pip install transformers==4.46.3 tokenizers==0.20.3. The first Run also waits on the ~8–10 GB model download triggered by Load, so don't panic at a silent first inference.
Where people get burned, in order of likelihood:
- Garbled or empty text - usually the wrong resolution for the document. Long multi-column page?
Gundam. Single screenshot?Base. Feed it a clean, well-lit image; it's good, but not a magician. - OOM mid-run - the model is roughly 6–7 GB in bf16. Drop the Load node to
fp16, or Run toTiny/Small, or both. - Locate draws nothing - check
reference_textactually matches something in the image, and remember boxes only appear invisualizationwhenoutput_typeisallorimage. - Box color not applying - custom colors must be a quoted
"R,G,B"string; a typo silently falls back to red (the node logs a warning).
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| model | DPSK_OCR | — | |
| image | IMAGE | — | |
| task | COMBO | Convert to Markdown | 4 options: Free OCR, Convert to Markdown, Parse Figure, Locate by Reference |
| resolution | COMBO | Gundam | 5 options: Gundam, Tiny, Small, Base, Large |
| output_type | COMBO | all | 3 options: text, image, all |
| reference_textopt | STRING | — | |
| box_coloropt | STRING | red | — |
| box_widthopt | INT | 21–10 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |
| visualization | IMAGE | — |