Detections Transformation¶
Class: DetectionsTransformationBlockV1
Apply customizable transformations to detection predictions using UQL (Query Language) operation chains, enabling flexible modification of bounding boxes, filtering detections, extracting properties, resizing boxes, and other detection manipulations through configurable operation sequences for advanced detection processing workflows.
How This Block Works¶
This block transforms detection predictions by applying a chain of UQL operations that can modify, filter, extract, or manipulate detection data. The block:
- Receives detection predictions (object detection, instance segmentation, or keypoint detection) and a list of UQL operations to apply
- Validates that operations_parameters doesn't contain reserved parameter names
- Builds an operations chain from the provided UQL operation definitions, creating a sequence of transformations to apply in order
- Separates operations_parameters into batch parameters (aligned with predictions) and non-batch parameters (applied to all predictions)
- Processes each prediction batch by applying the operations chain:
- Zips predictions with batch parameters to align data per batch item
- Combines batch and non-batch parameters into evaluation parameters for each prediction
- Applies the operations chain to the detections with the combined parameters
- Validates that the output is still sv.Detections (operations must preserve detection type)
- Returns the transformed detections for each input batch
The block supports a wide variety of UQL operations including filtering (DetectionsFilter), property extraction (ExtractDetectionProperty), bounding box transformations (resizing, scaling), and other detection manipulations. Operations are applied sequentially, allowing complex transformations through operation chaining. The block validates that transformations preserve the detection type, ensuring outputs remain compatible with other detection-processing blocks. Batch and non-batch parameters enable flexible operation parameterization, supporting both per-detection and global parameter values.
Common Use Cases¶
- Advanced Detection Filtering: Apply complex filtering logic to detection predictions (e.g., filter detections by class names using conditional statements, filter by confidence thresholds with multiple conditions, apply custom filtering criteria based on detection properties), enabling sophisticated detection selection workflows
- Bounding Box Transformations: Modify bounding box sizes, positions, or properties (e.g., resize bounding boxes proportionally, scale boxes by percentage, adjust box coordinates, transform box dimensions), enabling flexible bounding box manipulation
- Property Extraction and Filtering: Extract detection properties and filter based on extracted values (e.g., extract class names and filter by class lists, extract confidence scores and filter by thresholds, extract properties for conditional processing), enabling property-based detection processing
- Multi-Conditional Processing: Apply complex conditional transformations based on multiple detection criteria (e.g., transform detections based on class and confidence combinations, apply different operations for different detection types, conditionally modify detections based on multiple properties), enabling sophisticated conditional detection processing
- Detection Data Enrichment: Extract and add properties to detections for downstream processing (e.g., extract class names for filtering, compute detection properties, add metadata to detections), enabling enriched detection data for complex workflows
- Custom Detection Manipulation: Apply custom transformations not available in dedicated blocks (e.g., complex multi-step detection modifications, custom filtering and transformation combinations, specialized detection processing workflows), enabling flexible custom detection processing
Connecting to Other Blocks¶
This block receives detection predictions and produces transformed detections:
- After detection blocks (e.g., Object Detection, Instance Segmentation, Keypoint Detection) to apply custom transformations, filtering, or modifications to detection predictions, enabling flexible detection processing workflows
- Before dynamic crop blocks to filter or modify detections before cropping (e.g., filter detections by class before cropping, transform box sizes before cropping, extract specific detections for cropping), enabling optimized region extraction workflows
- Before classification or analysis blocks to prepare detections with custom filtering or transformations (e.g., filter detections for specific analysis, transform boxes for compatibility, prepare detections with custom criteria), enabling customized detection preparation
- In multi-stage detection workflows where detections need custom transformations between stages (e.g., filter and transform initial detections before secondary processing, apply custom modifications between detection stages, conditionally process detections based on criteria), enabling sophisticated multi-stage workflows
- Before visualization blocks to filter or transform detections for display (e.g., filter detections for visualization, transform boxes for presentation, customize detections for display purposes), enabling optimized visual outputs
- After detection blocks and before other transformation blocks to apply custom logic between transformations (e.g., filter after detection and before cropping, transform between detection stages, apply conditional modifications), enabling complex transformation pipelines with custom logic
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/detections_transformation@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
operations |
List[Union[ClassificationPropertyExtract, ConvertDictionaryToJSON, ConvertImageToBase64, ConvertImageToJPEG, DetectionsFilter, DetectionsOffset, DetectionsPropertyExtract, DetectionsRename, DetectionsSelection, DetectionsShift, DetectionsToDictionary, Divide, ExtractDetectionProperty, ExtractFrameMetadata, ExtractImageProperty, LookupTable, Multiply, NumberRound, NumericSequenceAggregate, PickDetectionsByParentClass, RandomNumber, SequenceAggregate, SequenceApply, SequenceElementsCount, SequenceLength, SequenceMap, SortDetections, StringMatches, StringSubSequence, StringToLowerCase, StringToUpperCase, TimestampToISOFormat, ToBoolean, ToNumber, ToString]] |
List of UQL (Query Language) operations to apply sequentially to the detections. Operations are executed in order, with each operation receiving the output of the previous operation. Supported operations include DetectionsFilter (filtering detections by conditions), ExtractDetectionProperty (extracting properties from detections), bounding box transformations (resizing, scaling), and other UQL operations that accept and return sv.Detections. Operations can be parameterized using operations_parameters. The operations chain must transform sv.Detections to sv.Detections (type must be preserved).. | ❌ |
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 Detections Transformation in version v1.
- inputs:
Crop Visualization,Image Slicer,ByteTrack Tracker,Google Gemini,SAM 3 Interactive,Time in Zone,Velocity,Image Slicer,Template Matching,Pixel Color Count,Multi-Label Classification Model,SIFT Comparison,Mask Area Measurement,Morphological Transformation,Background Subtraction,BoT-SORT Tracker,Ellipse Visualization,MoonshotAI Kimi,Multi-Label Classification Model,SAM 3,Grid Visualization,PLC ModbusTCP,Semantic Segmentation Model,Google Gemma,Byte Tracker,Overlap Filter,OpenAI,Multi-Label Classification Model,Path Deviation,Depth Estimation,Image Preprocessing,OPC UA Writer Sink,Detections Stabilizer,QR Code Detection,Stitch Images,Google Vision OCR,OpenAI,QR Code Generator,Florence-2 Model,Polygon Zone Visualization,Detection Offset,Cache Set,Contrast Equalization,VLM As Classifier,Clip Comparison,Pixelate Visualization,SORT Tracker,Qwen 3.6 API,Dot Visualization,Stability AI Outpainting,Byte Tracker,Keypoint Visualization,Anthropic Claude,PP-OCR,Anthropic Claude,Image Stack,Roboflow Visual Search Classifier,PTZ Tracking (ONVIF),Semantic Segmentation Model,Image Threshold,First Non Empty Or Default,JSON Parser,S3 Sink,MQTT Writer,Qwen-VL,CLIP Embedding Model,Stitch OCR Detections,Detections Consensus,SIFT,Nearest Neighbor Detection Match,Stitch OCR Detections,Auto Rotate on Edges,Time in Zone,VLM As Classifier,Instance Segmentation Model,Dimension Collapse,Trace Visualization,Seg Preview,EasyOCR,Camera Focus,Google Gemma API,PLC EthernetIP,Property Definition,OC-SORT Tracker,MoonshotAI Kimi,Distance Measurement,Data Aggregator,Path Deviation,Blur Visualization,Image Convert Grayscale,Microsoft SQL Server Sink,Barcode Detection,Moondream2,Clip Comparison,Dynamic Zone,Reference Path Visualization,Email Notification,Roboflow Visual Search,Environment Secrets Store,Rate Limiter,Keypoint Detection Model,Contrast Enhancement,GLM-OCR,Byte Tracker,Camera Focus,Heatmap Visualization,Roboflow Vision Events,Qwen2.5-VL,OpenAI-Compatible LLM,Label Visualization,Buffer,Single-Label Classification Model,Keypoint Detection Model,Detections Merge,Detections Filter,Line Counter,Anthropic Claude,Detection Event Log,Roboflow Dataset Upload,Instance Segmentation Model,Classification Label Visualization,Mask Edge Snap,Dynamic Crop,Per-Class Confidence Filter,Detections Transformation,Absolute Static Crop,Detections Classes Replacement,Overlap Analysis,Current Time,Expression,Cache Get,Roboflow Custom Metadata,Line Counter Visualization,OpenAI,Segment Anything 2 Model,Bounding Box Visualization,Morphological Transformation,Perception Encoder Embedding Model,Object Detection Model,Motion Detection,Cosmos 3,Cosine Similarity,Webhook Sink,VLM As Detector,Size Measurement,Bounding Rectangle,Single-Label Classification Model,SAM 3,Roboflow Dataset Upload,OpenAI,SAM2 Video Tracker,Qwen3.5,Camera Calibration,Qwen3-VL,SAM3 Video Tracker,Detections List Roll-Up,PLC Writer,CSV Formatter,Detections Stitch,Track Class Lock,Triangle Visualization,Stability AI Image Generation,Icon Visualization,Relative Static Crop,VLM As Detector,OCR Model,SAM 3,GeoTag Detection,Qwen 3.5 API,Halo Visualization,OpenRouter,Frame Delay,Local File Sink,Text Display,Roboflow Asset Library Attributes,LMM,Image Blur,Gaze Detection,Inner Workflow,Color Visualization,Corner Visualization,Continue If,Instance Segmentation Model,Google Gemini,Slack Notification,Event Writer,Identify Outliers,Google Gemini,Twilio SMS Notification,Single-Label Classification Model,Perspective Correction,Object Detection Model,Instance Segmentation Model,Twilio SMS/MMS Notification,Polygon Visualization,Model Monitoring Inference Aggregator,Stability AI Inpainting,Florence-2 Model,Qwen3.5-VL,Dominant Color,Delta Filter,Mask Visualization,Polygon Visualization,SIFT Comparison,Switch Case,Halo Visualization,SmolVLM2,Llama 3.2 Vision,Detections Combine,CogVLM,Circle Visualization,Image Contours,Line Counter,YOLO-World Model,Llama 3.2 Vision,Time in Zone,Background Color Visualization,Keypoint Detection Model,PLC Reader,Model Comparison Visualization,LMM For Classification,Object Detection Model,Email Notification,Identify Changes - outputs:
Crop Visualization,Detection Event Log,Roboflow Dataset Upload,ByteTrack Tracker,Color Visualization,Corner Visualization,Mask Edge Snap,Dynamic Crop,SAM 3 Interactive,Detections Transformation,Time in Zone,Per-Class Confidence Filter,Velocity,Detections Classes Replacement,Overlap Analysis,Stitch OCR Detections,Roboflow Custom Metadata,Event Writer,Detections Consensus,Mask Area Measurement,Nearest Neighbor Detection Match,Stitch OCR Detections,BoT-SORT Tracker,Time in Zone,Ellipse Visualization,Trace Visualization,Segment Anything 2 Model,Perspective Correction,Bounding Box Visualization,Camera Focus,Byte Tracker,Overlap Filter,OC-SORT Tracker,Distance Measurement,Path Deviation,Halo Visualization,Size Measurement,Path Deviation,Blur Visualization,Detections Stabilizer,Bounding Rectangle,Model Monitoring Inference Aggregator,Polygon Visualization,Stability AI Inpainting,Florence-2 Model,Line Counter,Roboflow Dataset Upload,SAM2 Video Tracker,Dynamic Zone,Mask Visualization,Florence-2 Model,Polygon Visualization,Detection Offset,Halo Visualization,Detections List Roll-Up,Pixelate Visualization,SORT Tracker,Detections Combine,Byte Tracker,Circle Visualization,Detections Stitch,Track Class Lock,Heatmap Visualization,Triangle Visualization,Roboflow Vision Events,Line Counter,Icon Visualization,Dot Visualization,Byte Tracker,Keypoint Visualization,Label Visualization,Time in Zone,Background Color Visualization,Model Comparison Visualization,PTZ Tracking (ONVIF),Detections Merge,GeoTag Detection,Detections Filter,Frame Delay
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Detections Transformation in version v1 has.
Bindings
-
input
predictions(Union[instance_segmentation_prediction,object_detection_prediction,keypoint_detection_prediction]): Detection predictions to transform using UQL operations. Supports object detection, instance segmentation, or keypoint detection predictions. The detections will be transformed by the operations chain defined in the operations field. All transformations must preserve the detection type (output must remain sv.Detections). The block processes batch inputs and applies transformations per batch item..operations_parameters(*): Dictionary mapping parameter names (used in operations) to workflow data sources or values. Parameters are referenced in operations (e.g., in conditional statements, filter operations) and provided at runtime. Supports both batch parameters (aligned with predictions, one value per batch item) and non-batch parameters (same value for all batch items). Parameters are automatically separated into batch and non-batch based on their data structure. Cannot use reserved parameter names. Use this to parameterize operations dynamically (e.g., provide class lists for filtering, provide thresholds for conditions, supply values for operations that need runtime parameters)..
-
output
predictions(Union[object_detection_prediction,instance_segmentation_prediction,keypoint_detection_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object ifobject_detection_predictionor Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object ifinstance_segmentation_predictionor Prediction with detected bounding boxes and detected keypoints in form of sv.Detections(...) object ifkeypoint_detection_prediction.
Example JSON definition of step Detections Transformation in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/detections_transformation@v1",
"predictions": "$steps.object_detection_model.predictions",
"operations": [
{
"filter_operation": {
"statements": [
{
"comparator": {
"type": "in (Sequence)"
},
"left_operand": {
"operations": [
{
"property_name": "class_name",
"type": "ExtractDetectionProperty"
}
],
"type": "DynamicOperand"
},
"right_operand": {
"operand_name": "classes",
"type": "DynamicOperand"
},
"type": "BinaryStatement"
}
],
"type": "StatementGroup"
},
"type": "DetectionsFilter"
}
],
"operations_parameters": {
"classes": "$inputs.classes"
}
}