Dimension Collapse¶
Class: DimensionCollapseBlockV1
Source: inference.core.workflows.core_steps.fusion.dimension_collapse.v1.DimensionCollapseBlockV1
Flatten nested batch data by reducing dimensionality from level n to level n-1, aggregating nested lists into a single flat list to enable data aggregation, batch flattening, and dimensionality reduction workflows where nested batch outputs (such as classification or OCR results from dynamically cropped images) need to be collapsed into a single-level batch for downstream processing.
How This Block Works¶
This block collapses the dimensionality of batch data by flattening nested lists one level. The block:
- Receives batch data at dimensionality level n (nested batch structure)
- Flattens the nested structure:
- Takes all elements from the nested batch structure
- Concatenates them into a single flat list
- Removes one level of nesting from the data structure
- Reduces dimensionality:
- Input data at level n (e.g., list of lists)
- Output data at level n-1 (e.g., single list)
- Maintains all data elements, just removes the nested structure
- Returns flattened output:
- Outputs a single list containing all elements from the nested input
- Elements are preserved in order (flattened sequentially)
- Output dimensionality is one level lower than input
This block is particularly useful when working with dynamically cropped images or other operations that create nested batch structures. For example, when you crop multiple objects from each image, you get a nested batch (level 2): a list where each element is itself a list of crops. Classification results for those crops also form a nested batch. The Dimension Collapse block flattens this nested structure into a single-level batch (level 1), allowing you to work with all results together.
Common Use Cases¶
- Aggregating Classification Results: Aggregate classification results from dynamically cropped images into a single list (e.g., classify crops from images then aggregate all results, collect classification results from multiple crops, flatten nested classification outputs), enabling classification aggregation workflows
- Aggregating OCR Results: Aggregate OCR results from dynamically cropped text regions into a single list (e.g., OCR crops from images then aggregate all text results, collect OCR results from multiple crops, flatten nested OCR outputs), enabling OCR aggregation workflows
- Batch Flattening: Flatten nested batch structures for downstream processing (e.g., flatten nested batches for analysis, reduce batch dimensionality for storage, collapse nested structures for filtering), enabling batch flattening workflows
- Data Aggregation: Aggregate results from nested batch operations into flat lists (e.g., aggregate results from nested operations, collect outputs from nested batches, flatten nested operation results), enabling data aggregation workflows
- Dimensionality Reduction: Reduce batch dimensionality to match requirements of downstream blocks (e.g., reduce dimensionality for blocks requiring level 1 inputs, flatten nested batches for compatibility, adjust dimensionality for workflow connections), enabling dimensionality adjustment workflows
- Result Collection: Collect and flatten results from nested processing operations (e.g., collect nested processing results, flatten operation outputs, aggregate nested operation data), enabling result collection workflows
Connecting to Other Blocks¶
This block receives nested batch data and produces flattened batch data:
- After blocks that create nested batches (crop blocks, classification on crops, OCR on crops) to flatten nested results (e.g., crop then classify then flatten, OCR crops then flatten, process nested batches then collapse), enabling nested-to-flat workflows
- Before blocks requiring single-level batches to provide flattened data (e.g., flatten before filtering, collapse before storage, aggregate before analysis), enabling flat-to-processing workflows
- Before data storage blocks to store aggregated flattened results (e.g., store aggregated classifications, save flattened OCR results, log collapsed batch data), enabling aggregation-to-storage workflows
- Before analytics blocks to analyze aggregated results (e.g., analyze aggregated classifications, perform analytics on flattened data, process collapsed batches), enabling aggregation-to-analytics workflows
- Before filtering blocks to filter flattened aggregated data (e.g., filter aggregated results, apply filters to collapsed batches, process flattened data), enabling aggregation-to-filter workflows
- In workflow outputs to provide aggregated flattened results as final output (e.g., aggregated classification outputs, flattened OCR outputs, collapsed batch outputs), enabling aggregation output workflows
Requirements¶
This block requires batch data at dimensionality level n (nested batch structure). The block automatically handles batch casting for the input parameter. The block reduces output dimensionality by 1 level (from level n to level n-1). All elements from the nested structure are preserved and flattened into a single list. The block works with any data type - it simply flattens the nested list structure without modifying individual elements. The output is a single-level batch containing all elements from the nested input, ordered sequentially as they appear in the nested structure.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/dimension_collapse@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | โ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to Dimension Collapse in version v1.
- inputs:
S3 Sink,Email Notification,Clip Comparison,Morphological Transformation,Path Deviation,SAM 3,VLM As Detector,Keypoint Detection Model,Qwen-VL,Twilio SMS/MMS Notification,YOLO-World Model,Line Counter,Time in Zone,Polygon Zone Visualization,Stitch OCR Detections,MoonshotAI Kimi,OpenAI-Compatible LLM,OpenAI,VLM As Detector,Heatmap Visualization,Keypoint Visualization,Email Notification,Seg Preview,Anthropic Claude,Stability AI Image Generation,Google Vision OCR,Llama 3.2 Vision,Camera Focus,Label Visualization,Instance Segmentation Model,SAM 3,Path Deviation,Qwen3.5,Overlap Filter,Local File Sink,Multi-Label Classification Model,SmolVLM2,Google Gemini,Rate Limiter,Motion Detection,Byte Tracker,Background Color Visualization,Mask Edge Snap,Instance Segmentation Model,Qwen 3.5 API,Google Gemini,Polygon Visualization,Moondream2,Velocity,Grid Visualization,SIFT Comparison,Florence-2 Model,Delta Filter,Barcode Detection,Time in Zone,OCR Model,Detection Event Log,Single-Label Classification Model,VLM As Classifier,Detections Filter,Qwen2.5-VL,Detections Merge,First Non Empty Or Default,Detections Stabilizer,LMM For Classification,Keypoint Detection Model,Image Preprocessing,Roboflow Dataset Upload,SIFT,Dynamic Zone,Corner Visualization,Segment Anything 2 Model,Stability AI Outpainting,Halo Visualization,Multi-Label Classification Model,Qwen3-VL,Qwen3.5-VL,Time in Zone,Detections List Roll-Up,Blur Visualization,Semantic Segmentation Model,Property Definition,Perception Encoder Embedding Model,Distance Measurement,VLM As Classifier,Trace Visualization,Morphological Transformation,Stitch OCR Detections,Gaze Detection,Reference Path Visualization,Halo Visualization,Model Comparison Visualization,Dot Visualization,JSON Parser,Pixel Color Count,Background Subtraction,QR Code Detection,Text Display,Detections Combine,Bounding Rectangle,ByteTrack Tracker,Absolute Static Crop,CSV Formatter,Florence-2 Model,Byte Tracker,Icon Visualization,Identify Outliers,Mask Area Measurement,Object Detection Model,Perspective Correction,SAM 3,BoT-SORT Tracker,Stability AI Inpainting,Image Convert Grayscale,Object Detection Model,Line Counter,QR Code Generator,OpenRouter,Model Monitoring Inference Aggregator,OpenAI,Llama 3.2 Vision,Image Threshold,OC-SORT Tracker,Anthropic Claude,Dynamic Crop,Size Measurement,Detections Consensus,Clip Comparison,Cache Set,Dominant Color,Continue If,Contrast Enhancement,Bounding Box Visualization,Detection Offset,Depth Estimation,Keypoint Detection Model,CLIP Embedding Model,Image Contours,EasyOCR,Relative Static Crop,Multi-Label Classification Model,Polygon Visualization,Google Gemma API,Template Matching,Qwen 3.6 API,Single-Label Classification Model,Image Blur,Anthropic Claude,Per-Class Confidence Filter,Object Detection Model,Triangle Visualization,Roboflow Custom Metadata,OpenAI,SIFT Comparison,Slack Notification,Image Stack,Pixelate Visualization,Single-Label Classification Model,OpenAI,Stitch Images,Buffer,Instance Segmentation Model,Image Slicer,Environment Secrets Store,Line Counter Visualization,Image Slicer,Cosine Similarity,Detections Classes Replacement,Semantic Segmentation Model,Cache Get,LMM,Roboflow Dataset Upload,Expression,Detections Transformation,Color Visualization,Google Gemini,Data Aggregator,Classification Label Visualization,Camera Focus,Camera Calibration,Detections Stitch,Byte Tracker,Ellipse Visualization,PTZ Tracking (ONVIF),Identify Changes,SORT Tracker,Mask Visualization,GLM-OCR,Crop Visualization,Circle Visualization,CogVLM,Inner Workflow,Dimension Collapse,SAM2 Video Tracker,Contrast Equalization,Roboflow Vision Events,Webhook Sink,Twilio SMS Notification,MoonshotAI Kimi,Google Gemma - outputs:
Object Detection Model,Perspective Correction,SAM 3,Email Notification,Keypoint Detection Model,Path Deviation,VLM As Detector,Qwen-VL,SAM 3,Clip Comparison,Object Detection Model,Twilio SMS/MMS Notification,Line Counter,OpenRouter,YOLO-World Model,OpenAI,Llama 3.2 Vision,Line Counter,Time in Zone,Polygon Zone Visualization,MoonshotAI Kimi,Anthropic Claude,OpenAI,VLM As Detector,Detections Consensus,Size Measurement,Email Notification,Keypoint Visualization,Seg Preview,Anthropic Claude,Llama 3.2 Vision,Clip Comparison,Cache Set,Label Visualization,SAM 3,Instance Segmentation Model,Path Deviation,Bounding Box Visualization,Google Gemini,Keypoint Detection Model,Motion Detection,Polygon Visualization,Google Gemma API,Qwen 3.6 API,Instance Segmentation Model,Qwen 3.5 API,Google Gemini,Polygon Visualization,Grid Visualization,Anthropic Claude,Florence-2 Model,Triangle Visualization,Time in Zone,Object Detection Model,OpenAI,VLM As Classifier,Instance Segmentation Model,Buffer,LMM For Classification,Keypoint Detection Model,Roboflow Dataset Upload,Line Counter Visualization,Detections Classes Replacement,Corner Visualization,Halo Visualization,Roboflow Dataset Upload,Time in Zone,Detections List Roll-Up,Color Visualization,Google Gemini,Classification Label Visualization,VLM As Classifier,Trace Visualization,Reference Path Visualization,Halo Visualization,Ellipse Visualization,Dot Visualization,Mask Visualization,Crop Visualization,Circle Visualization,Florence-2 Model,Webhook Sink,MoonshotAI Kimi,Google Gemma
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Dimension Collapse in version v1 has.
Bindings
-
input
data(*): Reference to step outputs at dimensionality level n (nested batch structure) to be flattened and collapsed to level n-1. The input should be a nested batch (e.g., list of lists) where each nested level represents a batch dimension. The block flattens this structure by concatenating all nested elements into a single flat list. Common use cases: classification results from cropped images (level 2 โ level 1), OCR results from cropped regions (level 2 โ level 1), or any nested batch structure that needs to be flattened..
-
output
output(list_of_values): List of values of any type.
Example JSON definition of step Dimension Collapse in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/dimension_collapse@v1",
"data": "$steps.classification_step.predictions"
}