Skip to main content

SocialDistancing

Apply the social distancing algorithm to the list of detections.

Examples:

REST API:

WIP

Configuration File:

```yaml
elements:
- name: infer
args:
model: person-detection-nano
score_threshold: 0.3
iou_threshold: 0.3
- name: social-distancing
args:
threshold: 0.2
sources:
- address: videos/sd_london_station_sd.mp4
type: file
```

SocialDistancing Objects

class SocialDistancing(Element)

Apply the social distancing algorithm to the list of detections.

Attributes:

  • name str - The name of the element.
  • threshold float - The object nearness threshold {value between 0-1}.

Examples:

```python
ele = SocialDistancing()
```

process

def process(meta: PipelineMetadata)

Process the bounding boxes.

This is the main function for this element. It will take the bounding boxes and calculates distance between every object and flags if the distance is less than the threshold.

Arguments:

  • meta PipelineMetadata - The metadata to process.

Returns:

  • meta PipelineMetadata - The processed metadata.

Examples:

```python
ele = SocialDistancing()
meta = ele.process(meta)
```