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:
short-from : filter-item:<s/l-item(s)>
Only allow person detections:
source:
- address: https://youtu.be/jY86pXeTOLw
- type: youtube
pipeline:
- coco-nano:a:0.3:0.3
- filter-item:person
Only allow person and bus detections:
source:
- address: https://youtu.be/jY86pXeTOLw
- type: youtube
pipeline:
- coco-nano:a:0.3:0.3
- filter-item:[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.item
Union[str, List[str]] - The label of the item(s) to keep.
Examples:
Face:
ele = FilterItem("face")
Person:
ele = FilterItem("person")
extract_params
@staticmethod
def extract_params(model_params)
Extract the parameters for this element.
Arguments:
model_params
List[str] - The parameters for this element.
Returns:
item
Union[str, List[str]] - The item(s) to filter.
Raises:
ExtractParameterException
- If the parameters are not valid.
Examples:
params = FilterItem.extract_params(["person"])
ele = FilterItem(params)
process
def process(meta)
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 item is "*" then it will keep all detections.
Arguments:
meta
dict - The metadata to process.
Returns:
meta
dict - The processed metadata.
Examples:
params = FilterItem.extract_params(["person"])
ele = FilterItem(params)
meta = ele.process(meta)