Detections Filter¶
Class: DetectionsFilterBlockV1
Source: inference.core.workflows.core_steps.transformations.detections_filter.v1.DetectionsFilterBlockV1
Filter detection predictions based on customizable conditions, selectively removing detections that don't meet specified criteria (e.g., class names, confidence scores, bounding box properties) while preserving only the detections that match your filtering logic.
How This Block Works¶
This block applies conditional filtering to detection predictions using a flexible query language system. The block:
- Takes detection predictions (object detection, instance segmentation, or keypoint detection) and filtering operation definitions as input
- Evaluates each detection against the filtering conditions specified in the
operationsparameter - Extracts detection properties (e.g., class_name, confidence, bounding box coordinates) using property extraction operations
- Compares extracted properties against criteria using binary statements (e.g., class_name in list, confidence > threshold)
- Filters out detections that don't match the conditions, keeping only detections that satisfy the filter criteria
- Returns filtered predictions containing only the detections that passed the filter conditions
The block uses a query language system that supports extracting various detection properties (class names, confidence scores, bounding box coordinates, etc.) and applying conditional logic to filter detections. Filtering operations can check if properties are in lists, compare numeric values, check string equality, or use other comparators. The operations_parameters dictionary provides runtime values (like class name lists or thresholds) that are referenced in the filtering operations, allowing dynamic filtering criteria that can change based on workflow inputs or computed values. Multiple filtering operations can be chained together to create complex filtering logic.
Common Use Cases¶
- Class-Based Filtering: Filter detections to keep only specific object classes (e.g., keep only "person" and "car" detections, remove all others), enabling focused processing on relevant object types while excluding unwanted detections
- Confidence Threshold Filtering: Remove low-confidence detections to improve detection quality (e.g., keep detections with confidence > 0.7, filter out uncertain predictions), ensuring downstream processing works with reliable detections
- Multi-Criteria Filtering: Apply multiple filtering conditions simultaneously (e.g., keep detections where class_name is in allowed list AND confidence > threshold), combining class and confidence filtering for precise control
- Dynamic Filtering Based on Workflow State: Use workflow inputs or computed values to determine filtering criteria (e.g., filter classes based on user input, adjust confidence threshold based on lighting conditions), enabling adaptive filtering that responds to changing conditions
- Pre-Processing for Downstream Blocks: Filter detections before passing to visualization, counting, or storage blocks (e.g., remove false positives before counting, filter out background classes before visualization), reducing noise and improving accuracy of subsequent operations
- Selective Processing Workflows: Route different filtered subsets to different downstream blocks (e.g., filter high-confidence detections to one path, low-confidence to another), enabling conditional processing based on detection quality or type
Connecting to Other Blocks¶
The filtered predictions from this block can be connected to:
- Detection model blocks (e.g., Object Detection Model, Instance Segmentation Model, Keypoint Detection Model) to receive predictions that are filtered based on class, confidence, or other properties
- Visualization blocks (e.g., Bounding Box Visualization, Polygon Visualization, Label Visualization) to display only the filtered detections, reducing visual clutter and focusing on relevant objects
- Counting and analytics blocks (e.g., Line Counter, Time in Zone, Velocity) to count or analyze only specific filtered classes or confidence levels, ensuring accurate metrics for the objects of interest
- Data storage blocks (e.g., Local File Sink, CSV Formatter, Roboflow Dataset Upload, Webhook Sink) to save or transmit only filtered detection results, reducing storage and bandwidth usage by excluding irrelevant detections
- Other transformation blocks (e.g., Detections Merge, Detections Transform, Detection Offset) to apply additional transformations to the filtered subset, enabling complex processing pipelines on filtered detections
- Flow control blocks (e.g., Continue If, Rate Limiter) to conditionally trigger downstream processing based on whether filtered detections meet certain criteria, enabling conditional workflows based on filtered results
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/detections_filter@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]] |
Definition of filtering logic using the query language system. Specifies one or more filtering operations (e.g., DetectionsFilter) that use StatementGroup syntax to define conditional logic. Each operation can extract detection properties (class_name, confidence, coordinates, etc.) and compare them using binary statements (e.g., class_name in list, confidence > threshold). Multiple operations can be chained to create complex filtering logic. The operations reference parameter names from operations_parameters to access runtime values.. | ❌ |
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 Filter in version v1.
- inputs:
Anthropic Claude,Image Slicer,Dynamic Crop,Mask Area Measurement,BoT-SORT Tracker,Cache Get,SIFT Comparison,Stitch Images,Stitch OCR Detections,Instance Segmentation Model,Stability AI Inpainting,Distance Measurement,EasyOCR,Llama 3.2 Vision,Track Class Lock,Florence-2 Model,Gaze Detection,YOLO-World Model,Dominant Color,Model Comparison Visualization,Detections Classes Replacement,Line Counter Visualization,Byte Tracker,PLC Reader,Clip Comparison,CogVLM,PP-OCR,Detections List Roll-Up,Morphological Transformation,Instance Segmentation Model,OpenAI,Time in Zone,Detections Stabilizer,Image Contours,SAM 3,Roboflow Visual Search Classifier,QR Code Generator,OpenAI-Compatible LLM,Polygon Zone Visualization,Path Deviation,Roboflow Asset Library Attributes,GeoTag Detection,Camera Focus,Inner Workflow,Llama 3.2 Vision,VLM As Detector,Instance Segmentation Model,MQTT Writer,Roboflow Dataset Upload,Local File Sink,Bounding Rectangle,Google Gemini,Semantic Segmentation Model,Event Writer,Depth Estimation,Seg Preview,Byte Tracker,Google Gemini,OpenAI,Twilio SMS Notification,Pixel Color Count,Object Detection Model,Webhook Sink,Halo Visualization,Buffer,Switch Case,Dot Visualization,Image Stack,OPC UA Writer Sink,Image Slicer,Time in Zone,Contrast Enhancement,Morphological Transformation,Per-Class Confidence Filter,Halo Visualization,Clip Comparison,Google Gemma,Qwen 3.5 API,Qwen3.5,Single-Label Classification Model,Motion Detection,Multi-Label Classification Model,Detections Consensus,Overlap Analysis,Segment Anything 2 Model,Image Blur,Grid Visualization,Blur Visualization,GLM-OCR,Anthropic Claude,Google Vision OCR,Polygon Visualization,Data Aggregator,SIFT,Qwen 3.6 API,Text Display,JSON Parser,Qwen3.5-VL,Roboflow Vision Events,Identify Changes,Keypoint Detection Model,PLC ModbusTCP,S3 Sink,Line Counter,Roboflow Dataset Upload,SAM 3,Image Preprocessing,Single-Label Classification Model,Time in Zone,CLIP Embedding Model,Bounding Box Visualization,Object Detection Model,Mask Edge Snap,First Non Empty Or Default,Path Deviation,QR Code Detection,Expression,Absolute Static Crop,OpenAI,Email Notification,Frame Delay,Cosine Similarity,Roboflow Custom Metadata,Dynamic Zone,Auto Rotate on Edges,Byte Tracker,Detections Transformation,Keypoint Detection Model,Property Definition,Continue If,Stability AI Outpainting,Slack Notification,Camera Calibration,Single-Label Classification Model,VLM As Detector,SORT Tracker,Camera Focus,Corner Visualization,Ellipse Visualization,Rate Limiter,Anthropic Claude,Roboflow Visual Search,Color Visualization,Triangle Visualization,Detection Event Log,Object Detection Model,SAM 3,Image Threshold,Barcode Detection,Detections Merge,Current Time,Qwen2.5-VL,Florence-2 Model,Semantic Segmentation Model,SmolVLM2,Stitch OCR Detections,Microsoft SQL Server Sink,Moondream2,VLM As Classifier,Image Convert Grayscale,Label Visualization,Detection Offset,Stability AI Image Generation,Perception Encoder Embedding Model,Line Counter,Identify Outliers,Cache Set,VLM As Classifier,Trace Visualization,SAM 3 Interactive,PLC EthernetIP,Detections Filter,LMM For Classification,Velocity,Mask Visualization,Template Matching,Pixelate Visualization,Twilio SMS/MMS Notification,Environment Secrets Store,MoonshotAI Kimi,Multi-Label Classification Model,Google Gemini,OC-SORT Tracker,Keypoint Visualization,Dimension Collapse,LMM,Detections Combine,PTZ Tracking (ONVIF),OCR Model,Circle Visualization,Relative Static Crop,SAM2 Video Tracker,ByteTrack Tracker,Email Notification,Cosmos 3,Polygon Visualization,Qwen-VL,PLC Writer,Crop Visualization,Model Monitoring Inference Aggregator,Qwen3-VL,Keypoint Detection Model,Size Measurement,Icon Visualization,Heatmap Visualization,Google Gemma API,Instance Segmentation Model,Delta Filter,CSV Formatter,SAM3 Video Tracker,Detections Stitch,Background Color Visualization,Reference Path Visualization,Classification Label Visualization,Perspective Correction,Background Subtraction,Contrast Equalization,MoonshotAI Kimi,OpenRouter,OpenAI,SIFT Comparison,Multi-Label Classification Model,Overlap Filter - outputs:
Trace Visualization,SAM 3 Interactive,Time in Zone,Dynamic Crop,Mask Area Measurement,Detections Filter,BoT-SORT Tracker,Bounding Box Visualization,Byte Tracker,Mask Edge Snap,Velocity,Halo Visualization,Mask Visualization,Path Deviation,Pixelate Visualization,Dot Visualization,Stitch OCR Detections,Stability AI Inpainting,Frame Delay,Distance Measurement,OC-SORT Tracker,Keypoint Visualization,Track Class Lock,Florence-2 Model,Roboflow Custom Metadata,Dynamic Zone,Detections Combine,Detections Transformation,Byte Tracker,Time in Zone,PTZ Tracking (ONVIF),Circle Visualization,Model Comparison Visualization,Detections Classes Replacement,Byte Tracker,SAM2 Video Tracker,ByteTrack Tracker,Per-Class Confidence Filter,Halo Visualization,Polygon Visualization,SORT Tracker,Camera Focus,Ellipse Visualization,Corner Visualization,Crop Visualization,Model Monitoring Inference Aggregator,Detections List Roll-Up,Size Measurement,Heatmap Visualization,Icon Visualization,Color Visualization,Detections Consensus,Overlap Analysis,Triangle Visualization,Detection Event Log,Detections Stitch,Background Color Visualization,Detections Stabilizer,Segment Anything 2 Model,Time in Zone,Blur Visualization,Detections Merge,Florence-2 Model,Stitch OCR Detections,Path Deviation,GeoTag Detection,Perspective Correction,Polygon Visualization,Label Visualization,Detection Offset,Line Counter,Roboflow Dataset Upload,Roboflow Vision Events,Bounding Rectangle,Overlap Filter,Event Writer,Line Counter,Roboflow Dataset Upload
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
Detections Filter in version v1 has.
Bindings
-
input
predictions(Union[instance_segmentation_prediction,keypoint_detection_prediction,object_detection_prediction]): Detection predictions to filter (object detection, instance segmentation, or keypoint detection). Each detection is evaluated against the filtering conditions specified in the operations parameter. Only detections that match the filter criteria are included in the output. Supports batch processing, allowing filtering of multiple detection sets simultaneously..operations_parameters(*): Dictionary mapping parameter names (referenced in operations) to actual values from the workflow. These parameters provide runtime values used in filtering operations (e.g., class name lists, confidence thresholds). Keys match parameter names used in the operations definition, and values are selectors referencing workflow inputs, step outputs, or computed values. Example: {'classes': '$inputs.allowed_classes', 'threshold': 0.7} where 'classes' and 'threshold' are referenced in the operations..
-
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 Filter in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/detections_filter@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"
}
}