---
# System prepended metadata

title: 'Loitering:'

---

# Loitering: 


Trigger event(print warning) when people "enter" in "Alarmzone" 

- stay about 5 seconds
- consider re-triggering


Stream example
![](https://i.imgur.com/uxeoeAA.jpg)



```lang=python
def run_loitering(self, alarmzone, predictor):
    
    # alarmzone : Point((x1,y1), (x2,y2), (x3,y3), (x4,y4))
    
    # Object Detection: detections / type: (np.array)

    # detections[:, 0:4]: the top-left and bottom-right point of bounding box (xyxy)
    # detections[:, 4]: the score of object(float)
    # detections[:, 5]: the class id of object(int), 0 is person
    
    while True:
        # detections [[10, 15, 20, 30, 0.9, 1],[10, 12, 20, 34, 0.3, 0]]
        detections = predictor.predict(frame)
        
        

        

```
