Skip to main content

LineCrossing

Evaluates bbox intersection with a defined line as a boundary.

This use case also gives out an upcount and downcount for every boundary defined based on the direction in which detected objects cross the boundary.

Examples:

REST API:

WIP

Configuration File:

```yaml
elements:
- name: infer
args:
model: person-detection-0200
score_threshold: 0.3
iou_threshold: 0.3
- name: object-tracking-OH
args:
max_age: 3
min_hits: 3
history: 50
region: bottom
ratio: 0.2
moving_average: 3
- name: line-crossing
args:
directions: [-1]
history: 5
region: bottom
ratio: 0.2
config:
lines:
- name: Entrance
coords:
- x: 0.4864
y: 0.4731
- x: 0.3583
y: 0.7861
sources:
- address: videos/apartment.mp4
type: file
```

LineCrossing Objects

class LineCrossing(Element)

Evaluates bbox intersection with a define line as a boundary.

Attributes:

  • name str - The name of the element.
  • directions int - a list marking orientations of the region of interest.
  • history int - the min length of tracking history (in number of points) for which intersection with the line is checked.
  • region str - the region of the bounding box that should overlap for the line crossing to be registered
  • ratio float - the ratio of the bbox to be considered in the marked perspective for line crossing to be detected

Examples:

```python
ele = LineCrossing(directions=[-1], history=10, region="bottom", ratio=0.2)
```

process

def process(meta: PipelineMetadata)

Process the bounding boxes.

This is the main function for this element. It will take the bounding boxes and gives out an upcount and downcount for every boundary defined based on the direction in which detected objects cross the boundary.

Arguments:

  • meta PipelineMetadata - The metadata to process.

Returns:

  • meta PipelineMetadata - The processed metadata.

Examples:

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