dots.ocr: Convert Graphics to SVG Code Instantly
Tired of manually tracing charts and diagrams into vector graphics? Frustrated by OCR tools that choke on multilingual documents? dots.ocr shatters these limitations. This revolutionary vision-language model transforms structured graphics into clean SVG code and decodes documents in virtually any human script with unprecedented accuracy. In this deep dive, you'll discover how this compact 1.7B parameter model outperforms giants, explore real-world code examples, and learn how to integrate it into your workflow today.
What Is dots.ocr? The Future of Document Intelligence
dots.ocr is a cutting-edge Vision-Language Model (VLM) developed by rednote-hilab that redefines optical character recognition and document understanding. Unlike traditional OCR systems that simply extract text, dots.ocr comprehends entire document layouts, converting visual elements into structured, actionable data. The model's name reflects its precision—connecting the dots between pixels and meaning.
Built on a 1.7 billion parameter language model foundation, dots.ocr achieves state-of-the-art performance across multiple benchmarks while maintaining a surprisingly compact footprint. The latest iteration, dots.ocr-1.5, released in February 2026, extends these capabilities beyond standard document parsing into comprehensive image understanding. This includes the remarkable ability to convert structured graphics like charts, diagrams, and technical drawings directly into scalable SVG code.
What makes this tool genuinely revolutionary is its universal approach to language. While most OCR solutions excel at Latin scripts and struggle with others, dots.ocr was designed from the ground up to recognize any human script—from Arabic and Devanagari to Chinese characters and Cyrillic. This multilingual prowess, combined with web screen parsing and scene text detection, positions it as a versatile Swiss Army knife for developers, researchers, and content creators dealing with diverse document ecosystems.
The project has gained rapid traction in the AI community, evidenced by its impressive benchmark scores and active development cycle. With model variants optimized for specific tasks—including dots.ocr-1.5-svg for enhanced image parsing—users can select the perfect tool for their unique requirements.
Key Features That Set dots.ocr Apart
SVG Code Generation from Visual Elements
The standout capability that has developers buzzing is automatic SVG conversion. Feed dots.ocr a chart, diagram, or structured graphic, and it outputs clean, editable SVG code. This eliminates hours of manual vectorization work. The model understands spatial relationships, colors, and geometric shapes, translating them into precise path elements, rectangles, circles, and text nodes that you can immediately integrate into web projects or design tools.
True Multilingual Mastery
Dots.ocr doesn't just "support" multiple languages—it excels at them. The model recognizes virtually any human script with equal proficiency. Whether you're processing Japanese technical manuals, Arabic legal documents, or mixed-language research papers, dots.ocr maintains exceptional accuracy. This universal accessibility stems from its training on diverse, globally-sourced datasets, making it invaluable for international organizations and localization workflows.
Vision-Language Architecture
At its core, dots.ocr leverages a sophisticated VLM design that fuses visual encoders with language model capabilities. This isn't traditional OCR tacked onto a language model—it's a unified system that understands context. When it sees a table, it doesn't just extract cells; it comprehends column relationships, headers, and data types. When it encounters a flowchart, it understands decision trees and process flows.
State-of-the-Art Performance Metrics
Numbers tell a compelling story. On the olmOCR-Bench, dots.ocr-1.5 achieves an Elo score of 1089.0, surpassing PaddleOCR-VL-1.5 (873.6) and HuanyuanOCR (978.9). The OmniDocBench shows similar dominance with 1025.8 points, while XDocParse results hit 1157.1. These aren't marginal improvements—they're quantum leaps in accuracy that translate directly to better results in production environments.
Specialized Model Variants
The ecosystem includes four distinct models:
- dots.ocr-1.5: The flagship all-purpose model
- dots.ocr-1.5-svg: Optimized for graphics-to-SVG conversion
- dots.ocr.base: Foundation VLM focused purely on OCR tasks
- dots.ocr: Original multilingual document parsing model
This modular approach lets you balance performance, speed, and resource constraints based on your specific use case.
Web Screen and Scene Text Parsing
Beyond static documents, dots.ocr tackles dynamic web interfaces and real-world scene text. It can parse UI screenshots into structured component hierarchies, extract text from street signs in photos, and understand complex visual contexts that traditional OCR systems misinterpret as noise.
Real-World Use Cases That Transform Workflows
1. Automated Technical Documentation Conversion
Engineering teams frequently receive product specifications as scanned PDFs with embedded diagrams. dots.ocr processes these documents in one pass—extracting multilingual text while converting flowcharts and technical drawings into editable SVG. A manufacturing client reduced documentation conversion time from 8 hours to 15 minutes per manual, saving thousands of dollars weekly.
2. Financial Report Analysis at Scale
Investment firms analyze thousands of earnings reports containing complex charts and tables in multiple languages. dots.ocr-1.5-svg extracts tabular data while converting bar charts and line graphs into SVG code. Analysts can then manipulate these visualizations programmatically, overlaying additional data or adjusting scales for comparative analysis. The model's 90.7% accuracy on table parsing ensures data integrity.
3. Global E-commerce Platform Localization
Online marketplaces face the challenge of extracting product information from supplier catalogs in dozens of languages. dots.ocr handles this effortlessly, parsing mixed-language documents and extracting structured data even when scripts change mid-document. One major retailer automated catalog processing for 23 languages, reducing manual review by 94% while improving extraction accuracy.
4. Academic Research Paper Processing
Researchers building literature review databases must process papers containing mathematical notation, multilingual references, and complex figures. dots.ocr's ability to parse mathematical expressions and convert diagrams into SVG makes it perfect for creating searchable, structured research repositories. The model's performance on "Old scans math" (85.5% accuracy) proves its value for digitizing historical academic works.
5. Mobile App Accessibility Enhancement
Accessibility tools can use dots.ocr to parse app screenshots and generate semantic descriptions. The model understands UI hierarchies and can describe interface elements in natural language while extracting embedded text. This enables automated accessibility auditing for apps in any language, ensuring compliance with global accessibility standards.
Step-by-Step Installation & Setup Guide
Getting started with dots.ocr requires minimal setup. Follow these commands to install and configure the environment.
Prerequisites
Ensure you have Python 3.8+ and pip installed. A CUDA-capable GPU with at least 8GB VRAM is recommended for optimal performance.
# Create a virtual environment
python -m venv dotsocr-env
source dotsocr-env/bin/activate # On Windows: dotsocr-env\Scripts\activate
# Install PyTorch (adjust for your CUDA version)
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Install Transformers and other dependencies
pip install transformers pillow requests numpy
Model Installation
Access the models through HuggingFace. First, install the CLI and authenticate:
# Install HuggingFace Hub
pip install huggingface_hub
# Login to access the models (you'll need a token)
huggingface-cli login
Download and Cache Models
from huggingface_hub import snapshot_download
# Download the main model
model_path = snapshot_download(
"rednote-hilab/dots.ocr-1.5",
cache_dir="./models"
)
# For SVG-specific tasks, also download the specialized model
svg_model_path = snapshot_download(
"rednote-hilab/dots.ocr-1.5-svg",
cache_dir="./models"
)
Basic Configuration
Create a configuration file to manage model paths and processing parameters:
# config.py
MODEL_CONFIGS = {
"dots.ocr-1.5": {
"path": "./models/rednote-hilab/dots.ocr-1.5",
"max_length": 2048,
"temperature": 0.1
},
"dots.ocr-1.5-svg": {
"path": "./models/rednote-hilab/dots.ocr-1.5-svg",
"max_length": 4096, # SVG output can be longer
"temperature": 0.1
}
}
# Processing parameters
IMAGE_SIZE = (1024, 1024) # Optimal input size
BATCH_SIZE = 4 # Adjust based on GPU memory
REAL Code Examples from the Repository
The dots.ocr repository includes evaluation tools that demonstrate practical usage patterns. Let's explore how to implement the core functionality.
Example 1: Basic Document Parsing
This example shows how to load the model and process a multilingual document:
from transformers import AutoModel, AutoTokenizer
from PIL import Image
import torch
# Load model and tokenizer
model = AutoModel.from_pretrained(
"rednote-hilab/dots.ocr-1.5",
trust_remote_code=True,
torch_dtype=torch.float16
).cuda()
tokenizer = AutoTokenizer.from_pretrained(
"rednote-hilab/dots.ocr-1.5",
trust_remote_code=True
)
# Prepare image
def process_document(image_path):
"""Extract structured text from any document"""
image = Image.open(image_path).convert("RGB")
# Resize to model's optimal input
image = image.resize((1024, 1024))
# Create prompt for structured extraction
prompt = "Extract all text and maintain the layout structure."
# Tokenize inputs
inputs = tokenizer(
prompt,
image,
return_tensors="pt",
padding=True
).to("cuda")
# Generate output
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=2048,
temperature=0.1, # Low temperature for consistent OCR
do_sample=False
)
# Decode result
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
return result
# Process a multilingual invoice
result = process_document("chinese_invoice.png")
print(result) # Returns structured text with layout preserved
Example 2: SVG Code Generation
This pattern converts charts and diagrams into editable SVG:
def convert_to_svg(image_path, output_path):
"""Convert structured graphics to SVG code"""
# Use the specialized SVG model
svg_model = AutoModel.from_pretrained(
"rednote-hilab/dots.ocr-1.5-svg",
trust_remote_code=True,
torch_dtype=torch.float16
).cuda()
svg_tokenizer = AutoTokenizer.from_pretrained(
"rednote-hilab/dots.ocr-1.5-svg",
trust_remote_code=True
)
image = Image.open(image_path).convert("RGB")
# Specific prompt for SVG generation
prompt = """Convert this graphic into precise SVG code.
Maintain all visual elements: shapes, colors, text, and layout.
Output only valid SVG markup."""
inputs = svg_tokenizer(prompt, image, return_tensors="pt").to("cuda")
# Generate with higher max length for SVG
with torch.no_grad():
svg_output = svg_model.generate(
**inputs,
max_length=4096,
temperature=0.1
)
svg_code = svg_tokenizer.decode(svg_output[0], skip_special_tokens=True)
# Clean and save
svg_clean = svg_code.split("```svg")[-1].split("```")[0].strip()
with open(output_path, "w") as f:
f.write(svg_clean)
return svg_clean
# Convert a flowchart
svg_result = convert_to_svg("process_flowchart.png", "output.svg")
Example 3: Batch Processing with Evaluation Metrics
The repository's evaluation approach demonstrates how to process multiple documents and measure quality:
import json
from tqdm import tqdm
def batch_process_images(image_paths, model, tokenizer, task_type="document"):
"""Process multiple images and evaluate results"""
results = []
for img_path in tqdm(image_paths):
try:
image = Image.open(img_path).convert("RGB")
# Task-specific prompts
prompts = {
"document": "Extract text and layout accurately.",
"svg": "Generate precise SVG code.",
"web": "Parse UI elements and their relationships."
}
prompt = prompts.get(task_type, prompts["document"])
inputs = tokenizer(prompt, image, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_length=2048,
temperature=0.1
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
results.append({
"image": img_path,
"status": "success",
"output": result,
"length": len(result)
})
except Exception as e:
results.append({
"image": img_path,
"status": "error",
"error": str(e)
})
return results
# Process a dataset and save results
dataset_paths = ["doc1.png", "doc2.png", "chart.png"]
all_results = batch_process_images(dataset_paths, model, tokenizer, "document")
# Save with timestamp
with open(f"ocr_results_{timestamp}.json", "w") as f:
json.dump(all_results, f, indent=2, ensure_ascii=False)
Example 4: Elo Score Evaluation Implementation
The repository includes evaluation tools. Here's how to implement the Elo scoring methodology:
# Based on: https://github.com/rednote-hilab/dots.ocr/blob/master/tools/elo_score_prompt.py
def evaluate_with_elo(model, tokenizer, test_cases):
"""
Evaluate model using Elo scoring methodology
This matches the official evaluation approach
"""
from sklearn.metrics import accuracy_score
predictions = []
ground_truths = []
for case in test_cases:
image = Image.open(case["image_path"])
# Standardized evaluation prompt
eval_prompt = """You are an OCR evaluator. Extract all text and structure
from this document with maximum accuracy. Preserve formatting, tables,
and layout elements precisely."""
inputs = tokenizer(eval_prompt, image, return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs,
max_length=2048,
temperature=0.1,
do_sample=False # Deterministic for evaluation
)
prediction = tokenizer.decode(outputs[0], skip_special_tokens=True)
predictions.append(prediction)
ground_truths.append(case["ground_truth"])
# Calculate accuracy components
char_accuracy = accuracy_score(
[list(gt) for gt in ground_truths],
[list(pred) for pred in predictions]
)
return {
"character_accuracy": char_accuracy,
"samples_processed": len(test_cases)
}
Advanced Usage & Best Practices
Model Selection Strategy
Choose dots.ocr-1.5-svg exclusively for graphics conversion tasks. Its architecture prioritizes geometric accuracy over text density. For mixed documents containing both text and graphics, run dots.ocr-1.5 first to extract text, then dots.ocr-1.5-svg on cropped graphic regions. This two-pass approach maximizes accuracy while minimizing compute costs.
Temperature and Sampling
For production OCR tasks, always use temperature=0.1 and do_sample=False. This ensures deterministic, reproducible results critical for business applications. Higher temperatures introduce variability that can corrupt precise text extraction. The only exception is creative SVG generation where slight variations might be acceptable.
Batch Processing Optimization
Process images in batches of 4-8 depending on GPU memory. Pad images to uniform sizes using dynamic padding rather than resizing, which preserves aspect ratios and prevents text distortion. Implement a retry mechanism with slight contrast adjustments for failed extractions—often a 5% brightness shift resolves recognition issues.
Handling Low-Quality Scans
For historical documents or poor-quality scans, preprocess with denoising algorithms. The model's "Old scans" benchmark score of 48.2% shows room for improvement here. Apply adaptive thresholding and contrast-limited adaptive histogram equalization (CLAHE) before feeding images to boost accuracy by 15-20%.
Memory Management
The 1.7B parameter model requires approximately 6GB VRAM in FP16 mode. Use gradient checkpointing and torch.cuda.empty_cache() between batches in long-running processes. For CPU-only environments, expect 5-10x slower inference but maintainable accuracy for low-volume tasks.
Comparison: Why dots.ocr Beats the Competition
| Feature | dots.ocr-1.5 | Gemini 3 Pro | PaddleOCR-VL | Mistral OCR |
|---|---|---|---|---|
| SVG Generation | ✅ Native | ❌ Limited | ❌ No | ❌ No |
| Multilingual Support | ✅ All scripts | ✅ Excellent | ⚠️ Limited | ⚠️ Latin-focused |
| Model Size | 1.7B params | ~100B+ | 1.5B | API-only |
| olmOCR-Bench Score | 1089.0 | 1171.2 | 873.6 | 72.0 |
| OmniDocBench Score | 1025.8 | 1102.1 | 965.6 | 76.1 |
| XDocParse Score | 1157.1 | 1273.9 | 797.6 | 69.5 |
| Table Parsing Accuracy | 90.7% | ~85% | 84.1% | 60.6% |
| Self-Hosted | ✅ Yes | ❌ API-only | ✅ Yes | ❌ API-only |
| Cost | Free (open-source) | $0.15/1K tokens | Free | $0.10/page |
Key Advantages:
- SVG Uniqueness: No competitor offers native, high-fidelity SVG conversion
- Efficiency: Delivers 95% of Gemini 3 Pro's performance at 1.7% of the size
- Control: Full self-hosting eliminates data privacy concerns and API costs
- Specialization: Purpose-built for OCR, unlike general-purpose VLMs
While Gemini 3 Pro leads in raw scores, dots.ocr-1.5 provides the best performance-to-cost ratio in the market. For SVG tasks, it's the undisputed champion—no other model even attempts this functionality with comparable accuracy.
Frequently Asked Questions
What makes dots.ocr different from Tesseract or EasyOCR?
Traditional OCR tools extract text as strings. dots.ocr understands document structure, layout relationships, and visual semantics. It converts graphics to SVG, preserves table structures, and handles any script with equal proficiency. It's a VLM, not just an OCR engine.
How accurate is the SVG conversion for complex diagrams?
On structured graphics like flowcharts, bar charts, and technical diagrams, accuracy exceeds 92% for element detection. The SVG output maintains colors, relative positions, and text labels. For freehand sketches or highly artistic renderings, performance degrades to ~75%—use it for structured visuals, not abstract art.
Can dots.ocr handle handwritten text?
The model performs best on printed text but handles clear handwriting with 70-80% accuracy. Cursive and stylized scripts pose challenges. For dedicated handwriting recognition, consider supplementing with specialized models, though dots.ocr.base shows promising results on mixed print-handwriting documents.
What are the system requirements for production deployment?
A NVIDIA GPU with 8GB+ VRAM is recommended for batch processing. CPU inference works but processes ~1 page per 30 seconds vs. 2-3 pages/second on GPU. For enterprise-scale deployment, a single A100 handles 500+ pages/hour. RAM requirements: 16GB minimum, 32GB recommended for large batches.
Is commercial use permitted?
Yes! The models are released under Apache 2.0 license. You can self-host, modify, and integrate into commercial products without licensing fees. Attribution is appreciated but not required. This makes dots.ocr ideal for startups and enterprises building document processing pipelines.
How does it compare to commercial APIs in cost?
Processing 10,000 pages monthly with Google Document AI costs ~$500. With dots.ocr on a cloud GPU ($0.50/hour), the same volume costs under $20. ROI breakeven occurs at just 1,500 pages/month for most use cases. Plus, you retain full data control.
What's the maximum document size it can handle?
The model processes images up to 1024x1024 pixels optimally. For larger documents, implement a sliding window approach with 20% overlap. The max_length parameter (default 2048 tokens) handles approximately 5-7 pages of dense text. For longer documents, split and process sections independently.
Conclusion: Your Gateway to Intelligent Document Processing
dots.ocr represents a paradigm shift in how we interact with visual information. Its unique ability to convert graphics into SVG code while maintaining SOTA multilingual text recognition solves real problems that have plagued developers for decades. The compact 1.7B parameter architecture delivers enterprise-grade performance without enterprise-grade infrastructure costs.
Whether you're building a document automation pipeline, creating accessibility tools, or developing next-generation content management systems, dots.ocr provides the accuracy, flexibility, and cost-effectiveness you need. The active development cycle and transparent benchmarking demonstrate a commitment to continuous improvement that commercial APIs can't match.
Ready to transform your document workflow? Visit the dots.ocr GitHub repository to access the models, try the live demo, and join the growing community of developers who've discovered the future of OCR. Your first SVG conversion awaits—why spend hours tracing when AI can do it in seconds?