Skip to main content

DwellTimeTracking

Detects object dwell time in a pre-defined zone.

This module provides a pipeline element to track dwell time of any bounding box for a period of time. This module can also check for zone intersection, and only track dwell times for bounding boxes that have intersected with a zone.

Examples:

REST API:

WIP

Configuration File:

```yaml
elements:
- name: infer
args:
model: person-detection-nano
- name: dwell-time-tracking
args:
max_age: 3
min_hits: 3
history: 50
region: bottom
ratio: 0.2
moving_average: 3
dwell_time: 15
inside_zones: false
sources:
- address: videos/loiter_sample.mp4
type: file
```

DwellTimeTracking Objects

class DwellTimeTracking(Element)

Detects object dwell time in a pre-defined zone.

Attributes:

  • name str - The name of the element.
  • max_age int - the number of consecutive iterations for which the tracker needs to be maintained for any object after it has stopped being detected.
  • min_hits int - the min length of tracking history (in number of points) for which intersection with a defined zone is checked.
  • history int - the length of the list containing history as a cyclic buffer
  • region str - the region of the bounding box that should overlap for the zone intersection to be registered.
  • ratio float - the ratio of the bbox to be considered in the marked perspective for the zone intersection to be detected.
  • moving_average int - the average change in a data series over time.
  • dwell_time int - time in seconds for dwell time to be marked as exceeded.
  • inside_zones bool - flag to check for dwell time within a zone.

Examples:

```python
ele = DwellTimeTracking(3, 3, 50, "bottom", 0.2, 3, 15)
```

process

def process(meta: PipelineMetadata)

Process the bounding boxes.

This is the main function for this element. It takes the bounding boxes and checks for bounding boxes exceeding a preset dwell_time, it also checks for zone intersection to flag only bounding boxes that are inside a zone and also found to exceed the dwell time.

Arguments:

  • meta PipelineMetadata - The metadata to process.

Returns:

  • meta PipelineMetadata - The processed metadata.

Examples:

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