Skip to main content

ZoneIntersection

Applies zone intersection between marked zones and the list of detections.

This module provides a pipeline element to detect intersections over a pre-defined keep out zone. This module takes a bounding box and a keep out zone and check if the bounding box intersects with the zone.

Examples:

REST API:

WIP

Configuration File:

short-from : detect-zone-intersection:<s-zone_config_path>:<s-tracking>:<s-region_to_check>: <f-ratio>:<i-zone_threshold>

pipeline:
- person-detection-nano:a:0.3:0.3
- detect-zone-intersection:conf/zones.json
sources:
- address: videos/demo-tracking-28s.mp4
- type: file

DetectZoneIntersection Objects

class DetectZoneIntersection(Element)

Applies zone intersection in a marked zone for the list of detections.

Attributes:

  • name str - The name of the element.
  • zone_config_path str - this relative path to the json file marking the zones.
  • tracking str - this flag enables the feature to track bounding boxes that intersect the defined zones.
  • region_to_check str - the region of the bounding box that should overlap for the intersection to be registered.
  • ratio float - the ratio of the bbox to be considered in the marked perspective for intersection to be registered.
  • zone_threshold int - min number of zones to intersect for flagging the object id

Examples:

ele = DetectZoneIntersection("conf/zones.json")

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:

  • zone_config_path str - this relative path to the json file marking the zones
  • tracking str - this flag enables the feature to track bounding boxes that intersect the defined zones.
  • region_to_check str - the region of the bounding box that should overlap for the intersection to be registered.
  • ratio float - the ratio of the bbox to be considered in the marked perspective for intersection to be registered.
  • zone_threshold int - min number of zones to intersect for flagging the object id

Raises:

  • ExtractParameterException - If the parameters are not valid.

Examples:

params = DetectZoneIntersection.extract_params(["conf/zones.json"])
ele = DetectZoneIntersection(*params)

process

def process(meta)

Process the bounding boxes.

This is the main function for this element. It takes the bounding boxes and detects any overlap with the keep out zone, the intersecting bounding boxes are flagged.

Arguments:

  • meta dict - The metadata to process.

Returns:

  • meta dict - The processed metadata.

Examples:

ele = DetectZoneIntersection("conf/zones.json")
meta = ele.process(meta)