Skip to main content

MovingAverage

Calculate Moving Avg of Detection Count.

This module provides a pipeline element to calculate the moving avg of the detection count measured across a certain pre-defined window. There is an optional argument to specify the moving average window.

Examples:

REST API:

WIP

Configuration File:

Moving Avg with default:

```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: infer
args:
model: person-detection-nano
mode: a
score_threshold: 0.3
iou_threshold: 0.3
- name: moving-average
```

Moving Avg with window specified:

```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: infer
args:
model: person-detection-nano
mode: a
score_threshold: 0.3
iou_threshold: 0.3
- name: moving-average
args:
window: 10
```

MovingAverage Objects

class MovingAverage(Element)

Calculate Moving Avg of Detection Count.

This element calculates moving avg of the detection count measured across a certain pre-defined window.

Attributes:

  • name str - The name of the element.
  • window int - The moving average window.

Examples:

Default:

```python
ele = MovingAverage()
```

```python
ele = MovingAverage(window=10)
```

process

def process(meta: PipelineMetadata)

Process the bounding boxes.

This is the main function for this element. It will calculate moving avg of the detection count measured across a certain pre-defined window.

Arguments:

  • meta PipelineMetadata - The metadata to process.

Returns:

  • meta PipelineMetadata - The processed metadata.

Examples:

```python
meta = MovingAverage().process(meta)
```