SocialDistancing
Apply the social distancing algorithm to the list of detections.
Examples:
REST API:
WIP
Configuration File:
short-form
-social-distancing:<f-threshold>
f-threshold
: object nearness threshold {value between 0-1}.
pipeline:
- person-detection-nano:a:0.3:0.3
- social-distancing: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:
ele = SocialDistancing()
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:
threshold
float - The object nearness threshold {value between 0-1}.
Raises:
ExtractParameterException
- If the parameters are not valid.
Examples:
params = SocialDistancing.extract_params(["0.2"])
ele = SocialDistancing(*params)
process
def process(meta)
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
dict - The metadata to process.
Returns:
meta
dict - The processed metadata.
Examples:
ele = SocialDistancing()
meta = ele.process(meta)