Files

2.2 KiB

🚀 QUICK START - Surya OCR Node

✅ READY TO USE!

Node Name: Surya OCR & Layout Detection
Category: text/ocr
File: nodes/surya_ocr_layout_node.py


📝 CRITICAL SETUP (READ THIS FIRST!)

Your GPU has a Flash Attention incompatibility issue!

Fix: Always set force_cpu_layout = True

This is NOT optional for your RTX Blackwell GPU!


⚡ Quick Usage

1. Restart ComfyUI
2. Add node: "Surya OCR & Layout Detection"
3. Set force_cpu_layout = True
4. Connect image input
5. Run!

mode: layout_and_ocr
confidence_threshold: 0.5
show_labels: True
batch_size: 2
force_cpu_layout: True  ← IMPORTANT!

📤 Outputs (7)

  1. annotated_image → Preview Image
  2. extracted_text → Text Display
  3. layout_json → JSON Parser
  4. text_bboxes_json → Crop Node (text)
  5. image_bboxes_json → Crop Node (images)
  6. full_data_json → Advanced Processing
  7. status → Info Display

🎯 What It Detects

Layout Elements:

  • Images (red boxes)
  • Tables (green boxes)
  • Text (blue boxes)
  • Titles (magenta boxes)
  • Headers/Footers (brown/gray)
  • Lists (cyan boxes)
  • Forms, Captions, etc.

Plus: Full OCR text extraction!


⚡ Performance

Your System (RTX PRO 6000 Blackwell):

  • Layout: ~2 sec (CPU)
  • OCR: ~0.5 sec (GPU)
  • Total: ~2.5 sec/image

Still fast enough for production use!


🔧 Common Workflows

Extract Text from Document

[Load Image] → [Surya OCR] → extracted_text → [Save Text]

Find & Crop Images

[Load Image] → [Surya OCR] → image_bboxes_json → [Parse] → [Crop]

Annotate Document

[Load Image] → [Surya OCR] → annotated_image → [Save Image]

❗ Troubleshooting

Error: CUDA PTX toolchain → Set force_cpu_layout = True

No detections → Lower confidence_threshold

Out of memory → Lower batch_size

Slow performance → Expected! CPU layout is slower but functional


📚 Full Documentation

See: SURYA_OCR_NODE_GUIDE.md


✨ You're Done!

The node is production-ready. Just restart ComfyUI and start using it!