This project is a full-stack AI-based public safety monitoring and risk detection system for crowd analysis, built for the Gemini 3 Hackathon.
The system combines computer vision with Gemini 3–powered reasoning to move beyond simple detection and enable context-aware public safety intelligence.
Public-Safety-Monitoring/
Core backend and frontend for crowd anomaly detection, contextual reasoning, and alerting
Traditional surveillance systems detect what is happening.
This system uses Gemini 3 to understand why it is happening and what action should be taken.
Computer vision models extract spatial and temporal signals from video, while Gemini 3 performs higher-level reasoning such as risk assessment, cause-and-effect analysis, and alert decision-making.
Real-time and batch video analysis for crowd risk detection
Spatial-temporal crowd behavior analysis
Risk classification: NONE / LOW / MEDIUM / HIGH
Gemini 3–based contextual reasoning for risk severity and alert decisions
Automatic police alert creation for MEDIUM and HIGH risk events
User dashboard for video upload and risk timeline visualization
Police dashboard for alert monitoring and acknowledgment
Persistent alert storage
Modern React frontend and FastAPI backend
Gemini 3 acts as the reasoning and decision-making layer of the system.
Workflow:
- Video frames are processed using computer vision models to extract crowd density, motion patterns, and anomalies.
- These signals are summarized into structured scene descriptions.
- The summaries are sent to the Gemini 3 API.
- Gemini 3 analyzes context across time to understand cause-and-effect relationships.
- Gemini 3 classifies risk severity and decides whether an alert should be triggered.
- Gemini 3 generates human-readable incident explanations for authorities.
This approach reduces false positives and transforms raw detections into actionable public safety intelligence.
Backend
Python
FastAPI
OpenCV
TensorFlow
Keras
YOLOv8
Uvicorn
python-dotenv
Frontend
React
Vite
Tailwind CSS
AI and Reasoning
Google Gemini 3 API for contextual reasoning, risk assessment, and alert generation
Other
Node.js
REST APIs
cd Public-Safety-Monitoring/backend
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
Add your Gemini 3 API key in the .env file.
cd Public-Safety-Monitoring/frontend
npm install
npm run devPublic-Safety-Monitoring/backend/ FastAPI backend, video analyzers, Gemini 3 integration, alert logic, and storage
Public-Safety-Monitoring/frontend/ React dashboards for users and police authorities
Public-Safety-Monitoring/Crowd_Anomaly_Detection/ Pretrained models and scripts for crowd analysis
Required configuration files:
backend/.env.example frontend/.env
These include Gemini 3 API credentials and service configuration values.
Pull requests are welcome. For major changes, please open an issue to discuss your proposal.