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