Skip to main content

LineCrossing

Applies violation of a marked 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 people cross the boundary.

Examples:

REST API:

WIP

Configuration File:

short-from : line-crossing:<s-line_json_path>:<l-inside_direction>:<i-min_hist>:<s-region_to_check>: <f-ratio>

pipeline:
- person-detection-0200:a:0.3:0.3
- people-tracking-OH:3:3:50:bottom:0.2:3
- name: line-crossing
- `directions` - [-1]
- `history` - 5
- `region` - bottom
- `ratio` - 0.2
config:
lines:
line1:
- `Name` - Entrance
Coords:
- x: 0.4864583333333333
- `y` - 0.47314814814814815
- x: 0.35833333333333334
- `y` - 0.7861111111111111
sources:
- address: videos/apartment.mp4
- type: file

LineCrossing Objects

class LineCrossing(Element)

Applies violation of a marked line as a boundary.

Attributes:

  • name str - The name of the element.
  • line_crossing_json_path str - this relative path to the json file marking the violation lines. Please refer the tools section on steps to generate this file.
  • inside_direction int - a list marking orientations of the region of interest.
  • min_hist int - the min length of tracking history (in number of points) for which intersection with violation_line is checked.
  • region_to_check str - the region of the bounding box that should overlap for the violation to be registered
  • ratio float - the ratio of the bbox to be considered in the marked perspective for violation to be detected

Examples:

ele = LineCrossing("conf/violation_line.json", "[-1]", "10", "None", "0.2")

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:

  • line_crossing_json_path str - this relative path to the json file marking the violation lines. Please refer the tools section on steps to generate this file.
  • inside_direction int - a list marking orientations of the region of interest.
  • min_hist int - the min length of tracking history (in number of points) for which intersection with violation_line is checked.
  • region_to_check str - the region of the bounding box that should overlap for the violation to be registered
  • ratio float - the ratio of the bbox to be considered in the marked perspective for violation to be detected

Raises:

  • ExtractParameterException - If the parameters are not valid.

Examples:

prm = LineCrossing.extract_params(["conf/violation_line.json","[1]","10","None","0.2"])
ele = LineCrossing(*prm)

process

 | def process(meta)

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 people cross the boundary.

Arguments:

  • meta dict - The metadata to process.

Returns:

  • meta dict - The processed metadata.

Examples:

ele = LineCrossing("conf/violation_line.json","[1]","10","None","0.2")
meta = ele.process(meta)