FilterItem
Filter out detections that are not part of a user-defined list of labels.
This module provides a pipeline element to filter out detections that are not part of a user-defined list of labels.
Examples:
REST API:
WIP
Configuration File:
Only allow person detections:
```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: infer
args:
model: coco-nano
score_threshold: 0.3
iou_threshold: 0.3
- name: filter-item
args:
labels: [person]
```
Only allow person and bus detections:
```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: infer
args:
model: coco-nano
score_threshold: 0.3
iou_threshold: 0.3
- name: filter-item
args:
labels: [person, bus]
```
FilterItem Objects
class FilterItem(Element)
Filter out detections that are not part of a user-defined list of labels.
Attributes:
name
str - The name of the element.labels
list[str] - The labels to keep.
Examples:
Face:
```python
ele = FilterItem(["face"])
```
Person:
```python
ele = FilterItem(["person"])
```
process
def process(meta: PipelineMetadata)
Filter out detections that are not part of a user-defined list of items.
This is the main function for this element. It filters out detections that are not part of a user-defined list of items. If the list of items is empty then it will keep all detections.
Arguments:
meta
PipelineMetadata - The metadata to process.
Returns:
meta
PipelineMetadata - The processed metadata.
Examples:
```python
meta = FilterItem(["person"]).process(meta)
```