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:
short-from :
dwell-time-tracking:<i-max_age>:<i-min_hits>:<i-history_buffer>:<s-region_to_check>:<f-ratio>:
<i-ma_len>:<i-dwell_time>:<s-inside_zones
pipeline:
- person-detection-nano:a:0.3:0.3
- dwell-time-tracking:3:3:50:bottom:0.2:3:15
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_buffer
int - the length of the list containing history as a cyclic bufferregion_to_check
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.ma_len
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
str - flag to check for dwell time within a zone.
Examples:
ele = DwellTimeTracking("3", "3", "50", "bottom", "0.2", "3", "15")
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:
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 defined zone is checked.history_buffer
int - the lenght of the list containing history as a cyclic bufferregion_to_check
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 zone intersection to be detected.ma_len
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
str - flag to check for dwell time within a zone.
Raises:
ExtractParameterException
- If the parameters are not valid.
Examples:
params = DwellTimeTracking.extract_params(["3", "3", "50", "bottom", "0.2", "3", "15"])
ele = DwellTimeTracking(*params)
process
| def process(meta)
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
dict - The metadata to process.
Returns:
meta
dict - The processed metadata.
Examples:
ele = DwellTimeTracking("3", "3", "50", "bottom", "0.2", "3", "15")
meta = ele.process(meta)