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:
VLM As Classifier,Line Counter,MoonshotAI Kimi,Stability AI Image Generation,Path Deviation,Trace Visualization,Qwen2.5-VL,Image Stack,Anthropic Claude,Per-Class Confidence Filter,Icon Visualization,SIFT Comparison,Morphological Transformation,Color Visualization,SmolVLM2,LMM For Classification,Single-Label Classification Model,Perspective Correction,Clip Comparison,Corner Visualization,Environment Secrets Store,Roboflow Custom Metadata,Detections Merge,Halo Visualization,Dynamic Zone,Keypoint Detection Model,Qwen-VL,JSON Parser,Email Notification,Halo Visualization,Object Detection Model,Data Aggregator,Google Gemma,Background Color Visualization,Ellipse Visualization,Email Notification,Twilio SMS/MMS Notification,Text Display,Polygon Visualization,Crop Visualization,Absolute Static Crop,Image Preprocessing,Template Matching,Model Monitoring Inference Aggregator,Relative Static Crop,OpenRouter,OpenAI,PLC ModbusTCP,Florence-2 Model,VLM As Detector,Motion Detection,Heatmap Visualization,OCR Model,OpenAI,Detections Filter,Perception Encoder Embedding Model,Blur Visualization,Dimension Collapse,Barcode Detection,Depth Estimation,Instance Segmentation Model,Stability AI Outpainting,Anthropic Claude,YOLO-World Model,Google Gemini,Clip Comparison,Google Gemini,PLC EthernetIP,Background Subtraction,Buffer,Keypoint Visualization,CSV Formatter,Webhook Sink,Byte Tracker,Stitch Images,Florence-2 Model,Current Time,Detections List Roll-Up,Contrast Equalization,Mask Edge Snap,OpenAI,Qwen3-VL,Moondream2,Line Counter,VLM As Detector,Google Gemini,Triangle Visualization,Slack Notification,Overlap Filter,Time in Zone,Inner Workflow,CLIP Embedding Model,First Non Empty Or Default,Detections Stabilizer,SIFT,Local File Sink,Multi-Label Classification Model,Cosine Similarity,Image Contours,Keypoint Detection Model,VLM As Classifier,Pixel Color Count,GLM-OCR,Roboflow Asset Library Attributes,Image Slicer,Polygon Zone Visualization,Time in Zone,Google Gemma API,Semantic Segmentation Model,Stitch OCR Detections,Image Threshold,Line Counter Visualization,Distance Measurement,Semantic Segmentation Model,Multi-Label Classification Model,Contrast Enhancement,Camera Calibration,QR Code Generator,Detection Offset,ByteTrack Tracker,Expression,Detection Event Log,Detections Transformation,S3 Sink,Microsoft SQL Server Sink,Mask Area Measurement,Google Vision OCR,Twilio SMS Notification,Image Blur,Detections Combine,Morphological Transformation,Property Definition,Camera Focus,Delta Filter,Size Measurement,Roboflow Vision Events,Stability AI Inpainting,PTZ Tracking (ONVIF),Classification Label Visualization,Bounding Rectangle,SAM2 Video Tracker,Stitch OCR Detections,Event Writer,Grid Visualization,Qwen3.5-VL,Byte Tracker,Switch Case,Dominant Color,Rate Limiter,Mask Visualization,Llama 3.2 Vision,Reference Path Visualization,Velocity,Label Visualization,Identify Outliers,Image Slicer,SIFT Comparison,Byte Tracker,OPC UA Writer Sink,Dot Visualization,Cache Set,Identify Changes,Dynamic Crop,Detections Stitch,Circle Visualization,Path Deviation,BoT-SORT Tracker,SAM3 Video Tracker,Camera Focus,Llama 3.2 Vision,Gaze Detection,Segment Anything 2 Model,OpenAI-Compatible LLM,MoonshotAI Kimi,Single-Label Classification Model,Overlap Analysis,QR Code Detection,Qwen3.5,CogVLM,Object Detection Model,SAM 3 Interactive,Qwen 3.6 API,Detections Consensus,Bounding Box Visualization,Multi-Label Classification Model,LMM,OpenAI,SAM 3,PLC Reader,Image Convert Grayscale,Instance Segmentation Model,Continue If,Roboflow Visual Search,EasyOCR,Roboflow Dataset Upload,SAM 3,Cache Get,Detections Classes Replacement,Instance Segmentation Model,Pixelate Visualization,Keypoint Detection Model,Roboflow Dataset Upload,SORT Tracker,Instance Segmentation Model,PLC Writer,Track Class Lock,Qwen 3.5 API,Anthropic Claude,Object Detection Model,Time in Zone,MQTT Writer,Polygon Visualization,OC-SORT Tracker,SAM 3,Model Comparison Visualization,Single-Label Classification Model,Seg Preview - outputs:
Polygon Zone Visualization,VLM As Classifier,Line Counter,MoonshotAI Kimi,Time in Zone,Google Gemma API,Seg Preview,Trace Visualization,Path Deviation,Line Counter Visualization,Anthropic Claude,Color Visualization,LMM For Classification,Perspective Correction,Clip Comparison,Corner Visualization,Halo Visualization,Keypoint Detection Model,Qwen-VL,Email Notification,Size Measurement,Halo Visualization,Object Detection Model,Classification Label Visualization,Google Gemma,Grid Visualization,Mask Visualization,Llama 3.2 Vision,Email Notification,Ellipse Visualization,Reference Path Visualization,Twilio SMS/MMS Notification,Label Visualization,Dot Visualization,Polygon Visualization,Cache Set,Crop Visualization,Path Deviation,Circle Visualization,Llama 3.2 Vision,SAM3 Video Tracker,OpenRouter,OpenAI,VLM As Detector,Florence-2 Model,OpenAI,Motion Detection,MoonshotAI Kimi,Object Detection Model,Instance Segmentation Model,Anthropic Claude,YOLO-World Model,Google Gemini,Qwen 3.6 API,Clip Comparison,Google Gemini,PLC EthernetIP,Detections Consensus,Keypoint Visualization,Buffer,Webhook Sink,Bounding Box Visualization,SAM 3,Florence-2 Model,PLC Reader,Instance Segmentation Model,Detections List Roll-Up,OpenAI,Line Counter,VLM As Detector,Google Gemini,Triangle Visualization,Roboflow Dataset Upload,SAM 3,Time in Zone,Instance Segmentation Model,Detections Classes Replacement,Keypoint Detection Model,Instance Segmentation Model,Roboflow Dataset Upload,Qwen 3.5 API,Object Detection Model,Anthropic Claude,Time in Zone,Keypoint Detection Model,VLM As Classifier,Polygon Visualization,SAM 3,Roboflow Asset Library Attributes
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"
}