How sai8143/accident-detection-accisense works
This repository implements a mobile-assisted road-accident detection service. A user captures a photo; the app attaches device location and submits it to the API, which scores the image, applies temporal filtering, and returns a potential/no-accident result. Separate API routes accept video frames or start live camera/RTSP monitoring; confirmed detections can be stored and trigger emergency logging. The graph also shows the persistence and detection layers. Unsampled service modules are included where substantial, but their behavior and connections are not inferred.
Main entry points: main.py FastAPI routes · api.js Alert API client · rtsp_stream.py Stream processing · CameraScreen.js Camera capture
Components 18
Mobile App
- Camera capture
mobile-app/src/screens/CameraScreen.js - Alert API client
mobile-app/src/services/api.js - API endpoint config
mobile-app/src/config.js - App entry
mobile-app/App.js
API Orchestration
- FastAPI routes
backend/app/main.py - API schemas
backend/app/schemas.py
Detection Services
- Photo scoring
backend/app/services/photo_detector.py - Temporal voting
backend/app/services/temporal_filter.py - Accident decision
backend/app/services/decision_engine.py - Video detection
backend/app/services/video_detector.py - Stream processing
backend/app/services/rtsp_stream.py - AI detector
backend/app/services/ai_detector.py - Crash classifier
backend/app/services/crash_classifier.py - Location service
backend/app/services/location.py
Persistence and Alerts
- Database setup
backend/app/database.py - Accident records
backend/app/models.py - Emergency notifier
backend/app/services/notifier.py
Other components
- Mobile user
Connections 17
- Mobile user → Camera capture: captures photo
mobile-app/src/screens/CameraScreen.js - App entry → Camera capture: renders
mobile-app/App.js - Camera capture → Alert API client: submits photo
mobile-app/src/screens/CameraScreen.js - Alert API client → API endpoint config: reads endpoint
mobile-app/src/services/api.js - Alert API client → FastAPI routes: posts alert
mobile-app/src/services/api.js - FastAPI routes → Photo scoring: scores image
backend/app/main.py - FastAPI routes → Temporal voting: filters score
backend/app/main.py - FastAPI routes → Accident decision: decides video result
backend/app/main.py - FastAPI routes → Video detection: detects frame
backend/app/main.py - FastAPI routes → Stream processing: starts monitoring
backend/app/main.py - Stream processing → Video detection: checks frames
backend/app/services/rtsp_stream.py - Stream processing → Emergency notifier: alerts on detection
backend/app/services/rtsp_stream.py - FastAPI routes → Emergency notifier: logs or alerts
backend/app/main.py - FastAPI routes → Accident records: creates record
backend/app/main.py - FastAPI routes → Database setup: opens session
backend/app/main.py - Accident records → Database setup: uses base
backend/app/models.py - FastAPI routes → API schemas: uses response schemas
backend/app/main.py