How hackabit19/devsena works
Project type and purpose
• ACCIDetect is a hybrid AI‐based accident detection system combining:
• A machine‐learning pipeline (data preprocessing, model training, real‐time inference)
• A real‐time detection service (Python scripts using OpenCV, TensorFlow, Twilio)
• A mobile client (Android app bundling a frozen TensorFlow graph for on‐device inference)
• The goal is to ingest CCTV video, detect accidents in real time, and notify emergency services.
File structure
• Top‐level files:
• ACCIDetect.ipynb / ACCIDetect.py – exploration & orchestration of experiments or inference
• ACCIdetect.pptx – presentation of the approach
• final.mp4 – demo video
• Readme.md – project description and workflow
• help.txt – miscellaneous notes
• ML directory:
• preprocessing.py – image‐to‐vector conversion and normalization
• trainV2.py – model training (ResNet‐based CNN)
• realtimeV2.py – server‐side real‐time inference on video streams
• hack directory: an Android client
• assets/frozen_inference_graph.pb + label_strings.txt – exported model and labels
• java/com/.../TensorFlowImageClassifier.java – Android wrapper for inference
• MainActivity.java – UI & camera feed capture
• AndroidManifest.xml, res/ – standard Android project layout
README for additional insights
• Workflow section describes:
a. Preprocessing of frames
b. Training a ResNet‐based model
c. Real‐time video inference and threshold‐based accident decision
d. Twilio SMS notifications to nearest services
• Technology stack: TensorFlow, Keras, OpenCV, scikit‐learn, Twilio
Main components
a. Data Capture Layer
• CCTV Cameras (live RTSP or HTTP video streams)
• Android Mobile Camera (optional client)
b. ML Training Pipeline (Offline)
• Raw Image Dataset (Kaggle) → preprocessing.py → Feature Vectors
• trainV2.py → ResNet CNN → Trained Model → Export to TensorFlow SavedModel / .pb
c. Inference Service (Online/Server)
• realtimeV2.py / ACCIDetect.py
• Video Frame Grabber (OpenCV)
• Model Loader (TensorFlow)
• Inference Engine → Probability Threshold
• Twilio API Client → SMS Notifications
d. Mobile Client (Android App)
• Local Camera Feed → TensorFlowImageClassifier
• On‐device inference (frozen_inference_graph.pb)
• Local Alert UI
e. External Services
• Twilio SMS Gateway
• Emergency Services Endpoints (Police, Ambulance, Fire Brigade)
Relationships and interactions
• CCTV Cameras → Inference Service (video frames over network)
• Inference Service loads model from Training Pipeline artifacts
• Inference Service → Twilio → Emergency Services (REST call)
• Mobile App uses same model artifacts for on‐device inference
• Optionally: Inference Service logs detections to a database or dashboard (if added later)
Architectural patterns & design principles
• Separation of Concerns:
• Offline Training vs. Online Inference vs. Mobile Client
• Modularization:
• ML preprocessing, training, real‐time inference each in separate scripts
• Portability:
• Exported .pb model for both server and mobile use
• Scalability (future):
• Inference Service could be containerized or broken into microservices per camera feed