from videodb import SceneExtractionType
violation_prompt = """
Focus on vehicles visible on the road and monitor them for the following traffic rule violations:
1. NO HELMET: Two-wheeler rider or pillion not wearing a helmet
2. MOBILE PHONE USE: Driver using mobile phone while operating the vehicle
3. WRONG SIDE DRIVING: Vehicle traveling against the designated traffic flow
4. RED LIGHT VIOLATION: Vehicle crossing when traffic signal is red
5. TRIPLE RIDING: More than two people on a single two-wheeler
6. NO SEATBELT: Driver or front passenger not wearing seatbelt
If you detect a violation, respond in this format:
Traffic Rule Violated
Vehicle: [vehicle type and color]
Plate Number: [license plate if visible, otherwise "Not Visible"]
Violation: [specific violation from the list]
Description: [brief description]
If NO violation is detected, respond ONLY with:
No Traffic Rule Violation Detected
"""
violation_scene_index = roadcam_stream.index_scenes(
extraction_type=SceneExtractionType.time_based,
extraction_config={
"time": 5,
"frame_count": 5,
},
prompt=violation_prompt,
name="Traffic_Violation_Index"
)