Modern cities face growing challenges in ensuring public safety. From crowded metros to busy intersections, monitoring many locations in real-time is tough.Traditional systems rely on humans watching multiple screens — costly, error-prone, and unable to correlate events across cameras.What if AI could monitor all feeds, detect incidents instantly, and alert authorities automatically?
Define one comprehensive analysis prompt and create indexes on all 7 streams:
analysis_prompt = """Analyze this public surveillance footage and identify key activities:1. Individuals or groups with notable items (suspicious gatherings, unusual luggage)2. Crowd behavior (large groups, sudden dispersal, running, congestion)3. Vehicle activity (unusual stopping, idling, vans/trucks in pedestrian areas)4. Unusual object detection (unattended bags, boxes in public spaces, abandoned items)5. General patterns of movement and deviations from norm6. Notable appearances or characteristics (distinctive clothing, unusual behavior)Be specific about appearance and location of events within camera's view."""# Create scene indexes for all camerasscene_indexes = {}for cam_name, rtstream in rtstreams.items(): scene_indexes[cam_name] = rtstream.index_visuals( batch_config={ "type": "time", "value": 15, "frame_count": 1, }, prompt=analysis_prompt, name=f"Surveillance_Analytics_{cam_name.upper()}", )
# Unattended Luggage (High Priority)luggage_event_id = conn.create_event( event_prompt="Detect luggage, backpacks, or packages left unattended.", label="unattended_luggage",)# Large Crowd Formation (Alert)crowd_event_id = conn.create_event( event_prompt="Identify when >4 people gather quickly in a concentrated area.", label="large_crowd_formation",)# Person with Trolley (Tracking)trolley_event_id = conn.create_event( event_prompt="Detect any person with trolley bag or rolling suitcase.", label="person_with_trolley",)# Person in Red Coat (Tracking)red_coat_event_id = conn.create_event( event_prompt="Identify person wearing a distinct red coat or jacket.", label="person_in_red_coat",)# Suspicious Loitering (Advisory)loitering_event_id = conn.create_event( event_prompt="Detect individuals loitering without clear purpose or unusual positioning.", label="suspicious_loitering",)
webhook_url = "https://your-security-center-webhook.com"event_ids = { "luggage": luggage_event_id, "crowd": crowd_event_id, "trolley": trolley_event_id, "red_coat": red_coat_event_id, "loitering": loitering_event_id,}# Create alerts for all 5 events on all 7 cameras (35 total alerts)for cam_name, scene_index in scene_indexes.items(): for event_type, event_id in event_ids.items(): scene_index.create_alert(event_id, callback_url=webhook_url)
Now you have a comprehensive 7-camera × 5-event surveillance grid (35 alert streams).
{ "event_id": "event-luggage-001", "label": "unattended_luggage", "confidence": 0.96, "explanation": "A black backpack is detected on the plaza ground with no person visibly attached to it. Has been stationary for >1 minute.", "timestamp": "2025-09-10T17:02:15.811085+00:00", "start_time": "2025-09-10T22:31:50.886736+05:30", "end_time": "2025-09-10T22:32:05.886736+05:30", "stream_url": "https://rt.stream.videodb.io/manifests/rts-019711db-1086-7750-ba79-8f47a4fed603/1757523710000000-1757523726000000.m3u8"}