MotionSegmenter
Drop bounding boxes if there hasn't been any significant change in their location.
This module provides a pipeline element to drop bounding boxes if there hasn't been any significant change in their location. The IoU threshold is the maximum amount of IoU allowable between the current and previous bounding box to keep it.
Examples:
REST API:
WIP
Configuration File:
```yaml
source:
- address: videos/sd_london_station_sd.mp4
type: file
elements:
- name: infer
args:
model: person-detection-medium
score_threshold: 0.3
iou_threshold: 0.3
- name: motion-segmenter
```
get_iou
def get_iou(box1, box2, h, w)
Implement the intersection over union (IoU) between box1 and box2
Arguments:
box1
- first box, numpy array with coordinates (ymin, xmin, ymax, xmax)box2
- second box, numpy array with coordinates (ymin, xmin, ymax, xmax)
MotionSegmenter Objects
class MotionSegmenter(Element)
Only make motion visible in the image.
Attributes:
name
str - The name of the element.
Examples:
```python
ele = MotionSegmenter()
```
process
def process(meta: PipelineMetadata)
Drop metadata if there hasn't been any significant change in the bounding boxes.
This is the main function for this element. it will process the metadata and drop bounding boxes if there hasn't been any significant change in their location.
Arguments:
meta
PipelineMetadata - The metadata to process.
Returns:
meta
PipelineMetadata - The processed metadata.
Examples:
```python
ele = MotionSegmenter()
meta = ele.process(meta)
```