Segmentation is the process of detecting and classifying layout elements in documents. Chunkr’s segmentation engine identifies regions like tables, images, text blocks, and other document components.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lumina-ai-inc/chunkr/llms.txt
Use this file to discover all available pages before exploring further.
Segmentation Strategies
Chunkr supports two segmentation strategies:- LayoutAnalysis
- Page
Detect and classify layout elementsThe
LayoutAnalysis strategy uses computer vision models to detect document layout elements and classify them into specific types.Features:- Detects 11 different segment types
- Provides bounding boxes for each element
- Assigns confidence scores
- Enables fine-grained chunking
- Supports complex document layouts
- Academic papers with tables and formulas
- Reports with mixed content
- Documents requiring precise element extraction
- When you need to process tables and images separately
Segment Types
When usingLayoutAnalysis, Chunkr detects these segment types:
Title
Title
Document or section titlesCharacteristics:
- Large, prominent text
- Usually at document/section start
- High hierarchy level (3)
- Often triggers new chunks
SectionHeader
SectionHeader
Section and subsection headersCharacteristics:
- Medium hierarchy level (2)
- Introduces new sections
- Triggers chunk boundaries
- Smaller than Title, larger than body text
Text
Text
Regular body text paragraphsCharacteristics:
- Most common segment type
- Hierarchy level 1
- Combines with adjacent text in chunks
ListItem
ListItem
Bullet points and numbered list itemsCharacteristics:
- Individual list entries
- Can be chunked together
- Preserves list structure
Table
Table
Tabular data and structured contentCharacteristics:
- Complex structure
- Usually processed with LLM strategy
- Can be paired with Caption
- Cropped image available
Picture
Picture
Images, figures, and diagramsCharacteristics:
- Visual content
- Always cropped
- Can be paired with Caption
- May contain OCR results if text present
Caption
Caption
Image and table captionsCharacteristics:
- Describes associated visual element
- Kept with paired Picture/Table in chunks
- Usually smaller text below/above element
Formula
Formula
Mathematical formulas and equationsCharacteristics:
- Mathematical notation
- Processed with LLM for LaTeX generation
- May be inline or block-level
Footnote
Footnote
Footnotes and referencesCharacteristics:
- Small text at page bottom
- References to main content
- Usually numbered or marked
PageHeader
PageHeader
Page headersCharacteristics:
- Appears at top of pages
- Often repetitive across pages
- Can be excluded from chunks
ignore_headers_and_footers: truePageFooter
PageFooter
Page
Page
Full page segment (only with Page strategy)Characteristics:
- Entire page as one segment
- Used when no layout analysis performed
- Contains all page OCR results
segmentation_strategy: "Page"Segment Structure
Each segment contains rich metadata:How Segmentation Works
1. Object Detection
Chunkr uses object detection models to identify layout elements: The model outputs:- Bounding boxes:
[left, top, width, height]coordinates - Class predictions: Integer class IDs (0-10)
- Confidence scores: Detection confidence (0.0-1.0)
2. Class Mapping
Class IDs are mapped to segment types:3. OCR Assignment
OCR results are assigned to segments based on spatial overlap:- Add padding to segment bounding boxes
- Calculate intersection area with each OCR result
- Assign OCR result to segment with maximum overlap
- Adjust OCR coordinates relative to segment
Segmentation padding is configurable via
segmentation_padding in worker config. Default padding ensures OCR results near segment edges are captured.4. Fallback Handling
If no segments are detected:Segmentation Quality
Confidence Scores
Each segment includes a confidence score from the detection model:- > 0.9: High confidence, very reliable
- 0.7 - 0.9: Good confidence, usually accurate
- 0.5 - 0.7: Medium confidence, may need review
- < 0.5: Low confidence, likely false positive
Accuracy Factors
Improves accuracy:- ✅ High-resolution images (
high_resolution: true) - ✅ Clear, well-formatted documents
- ✅ Standard layouts (papers, reports)
- ✅ Good contrast and quality scans
- ❌ Low-resolution or blurry images
- ❌ Unusual layouts or designs
- ❌ Heavily stylized documents
- ❌ Poor scan quality
Batched Processing
Segmentation uses batched processing for efficiency:- Faster processing for multi-page documents
- Efficient resource utilization
- Reduced network overhead
Configuration Examples
Academic Papers
Simple Documents
Reports with Tables
Error Handling
Witherror_handling: "Continue", segmentation failures fall back gracefully:
Next Steps
OCR Strategies
Learn about text extraction methods
Segment Processing
Configure content generation per segment type
Chunking
Understand how segments are combined
API Reference
See complete API documentation