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