MultiCam is a self-hosted, real-time AI surveillance platform.
It detects, tracks, and recognises people across multiple camera feeds simultaneously β
and clusters unrecognised faces automatically so no one slips through unnoticed.
| Feature | Description | |
|---|---|---|
| π₯ | Multi-Camera Dashboard | Webcams, RTSP, DroidCam, IP Webcam β all live |
| π§ | YOLOv8 Person Detection | Fast, accurate body detection at 60 FPS |
| π | DeepSORT Tracking | Persistent IDs across frames and cameras |
| π€ | FaceNet Recognition | InceptionResnetV1 + MTCNN identity matching |
| π | Active Search Mission | Hunt for a registered person across all live feeds |
| π§© | DBSCAN Auto-Clustering | Unknown faces grouped by appearance β no one is just "Unknown" |
| π | Register After the Fact | Name and enrol clustered unknowns directly from the UI |
| ποΈ | Detection History | Searchable log with snapshots, camera ID, timestamps |
| π· | Search by Photo | Upload any image to find matching detections |
| π¬ | Video Recordings | Browse and manage saved MP4s per camera |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FastAPI Backend β
β β
β CameraManager βββΊ CameraHandler threads (non-blocking) β
β β β raw frames β
β βΌ βΌ β
β process_camera() βββ frame queue β
β β β
β PersonDetector (YOLOv8n) every 5 frames β
β β β
β ObjectTracker (DeepSORT) persistent IDs β
β β β
β FaceRecognizer (MTCNN + FaceNet) β
β βββ known face β name + confidence β
β βββ unknown β UnknownFaceClusterer (DBSCAN) β
β β β
β DatabaseManager (SQLite) β sightings persisted β
β β β
β StreamingResponse βββΊ MJPEG β browser β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Layer | Technology |
|---|---|
| Web Framework | FastAPI + Uvicorn |
| Person Detection | Ultralytics YOLOv8n |
| Multi-Object Tracking | DeepSORT Realtime |
| Face Detection | MTCNN (facenet-pytorch) |
| Face Recognition | InceptionResnetV1 / FaceNet |
| Unknown Clustering | DBSCAN (scikit-learn) |
| Video Capture | OpenCV |
| Database | SQLite |
| Frontend | Vanilla JS + Jinja2 |
git clone https://github.com/tarunkumar-sys/MultiCam.git
cd MultiCam# Windows python -m venv venv venv\Scripts\activate # Linux / macOS python3 -m venv venv source venv/bin/activate
pip install -r requirements.txt
π‘ For GPU acceleration install the CUDA build of PyTorch before running the above:
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
python app.py
Open your browser at http://localhost:8000
Model weights (YOLOv8n + FaceNet) download automatically on first run.
From the dashboard sidebar β Add Camera:
| Type | Source format |
|---|---|
| Local Webcam | 0 (or 1, 2 for additional webcams) |
| RTSP | rtsp://user:password@192.168.1.100:554 |
| IP Webcam (Android) | 192.168.1.100 (port 8080 auto-appended) |
| DroidCam | 192.168.1.100 (port 4747 auto-appended) |
Passwords containing special characters like
@are automatically percent-encoded.
- Go to the Dashboard
- In the sidebar under Register Person, enter the full name
- Upload a clear, front-facing photo
- Click Register
The face encoding is extracted and stored immediately.
- Go to Search & History
- Type the registered person's name
- Click Start Search
MultiCam scans every active camera in real time. When the person is spotted, a snapshot is saved and logged. Click Stop Search to end the mission.
Faces that don't match any registered person are not discarded as "Unknown".
Instead, MultiCam:
- Extracts a 512-d FaceNet embedding for each unrecognised face
- Assigns it to the nearest DBSCAN cluster (or creates a new one)
- Labels clusters Unknown Person A, B, C ...
- Logs every sighting with camera ID and timestamp
- Re-runs DBSCAN every 60 seconds to merge drifted clusters
On the Search & History page, scroll to Unknown Persons (Auto-Clustered) to see:
π€ Unknown Person A
π Cam1 π 09:12:34
π Cam3 π 09:45:01
[ Enter name ] [ Register ]
Click Register to promote the cluster directly into the known persons database β no re-upload needed.
MultiCam/
βββ app.py # FastAPI app, routes, camera processing loop
βββ cameras/
β βββ camera_manager.py # Non-blocking camera capture threads
βββ database/
β βββ db_manager.py # SQLite β persons, detections, clusters, recordings
βββ utils/
β βββ detector.py # YOLOv8 person detection
β βββ tracker.py # DeepSORT tracking
β βββ recognizer.py # MTCNN + FaceNet recognition
β βββ clustering.py # DBSCAN unknown face clustering
βββ templates/ # Jinja2 HTML templates
βββ static/ # CSS + JS
βββ requirements.txt
βββ .gitignore
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Live dashboard |
GET |
/search |
Search & history page |
GET |
/recordings_page |
Video recordings browser |
POST |
/register |
Register a new person |
POST |
/add_camera |
Add a camera |
POST |
/delete_camera |
Remove a camera |
GET |
/video_feed/{camera_id} |
MJPEG live stream |
POST |
/api/start_search |
Start active search mission |
POST |
/api/stop_search |
Stop active search |
GET |
/api/active_search |
Current search target |
GET |
/api/search |
Query detection history |
POST |
/api/search_by_image |
Find person by uploaded photo |
GET |
/api/unknown_clusters |
List DBSCAN clusters |
POST |
/api/register_unknown |
Promote cluster to registered person |
DELETE |
/api/unknown_clusters/{id} |
Dismiss a cluster |
GET |
/api/recordings |
List video recordings |
DELETE |
/api/recordings/{id} |
Delete a recording |
POST |
/clear_history |
Wipe all detections + snapshots |
RTSP stream not connecting
- Verify the URL in VLC first
- Ensure UDP port 554 is not blocked by your firewall
- Cameras are added non-blocking β the server starts immediately even if the stream is unreachable
Face not recognised
- Register with a well-lit, front-facing photo
- Default threshold is
distance < 1.0β lower to0.8inutils/recognizer.pyfor stricter matching
Low FPS / high CPU
- Detection runs every 5 frames, face recognition every 10 β tune
frame_count % Ninapp.py - Use a GPU: install the CUDA PyTorch build before other deps
scikit-learn not found
pip install scikit-learn
MIT β free to use, modify, and distribute.
Made with π§ + β | github.com/tarunkumar-sys/MultiCam