Physical Violence Detection Using Key Framing (Android + CNN)
A production-ready violence detection android app built in Java/XML with Firebase Realtime Database. Users upload a video from the gallery; the app performs key frame extraction and runs a CNN to classify physical violence types like fight, kick, punch, gunshot. Results, scores, and timestamps appear with frame thumbnails—ready for reporting or academic evaluation.
- ✓Android Studio project (Java/XML), modular and well-documented
- ✓On-device TFLite CNN or server inference (switchable)
- ✓Frame gallery, per-class confidence, and exportable summaries
Project Objective
Deliver an accurate, efficient video violence detection app that turns long videos into representative key frames and classifies each segment using a CNN. Designed for academic projects, research demos, and proof-of-concepts where explainability (frame evidence + timestamps) matters.
How It Works
- Upload: Select a video from the gallery (MP4/AVI/MOV supported).
- Key Framing: Motion- and scene-change–based frame sampling extracts representative frames per interval.
- CNN Inference: Each key frame (or short clip) is resized/normalized and passed to a trained CNN (TFLite). Outputs class logits and confidence.
- Aggregation: Frame-level predictions are temporally smoothed to create segment labels (fight, kick, punch, gunshot, none).
- Report: Results with thumbnails, timestamps, and confidences are shown in-app and saved to Firebase for history.
Project Modules
Pick from gallery, scrub timeline, preview frames.
- MediaStore picker
- Thumbnail extraction
- Playback controls
Adaptive sampling via motion/scene change.
- Configurable interval
- Edge/blur rejection
- Fast bitmap pipeline
On-device inference; optional server switch.
- Labels: fight/kick/punch/gunshot/none
- Per-frame confidence
- Threshold tuning
Store metadata, logs, and images securely.
- Realtime DB + Storage
- History & sharing
- Auth-protected access
Firebase Realtime Database Structure (Example)
{ "users": { "uid123": {"name":"Alex","email":"a@b.com"} }, "videos": { "vid_17000001": { "owner":"uid123", "path":"gs://bucket/videos/vid_17000001.mp4", "durationSec": 92, "createdAt": 1725345600 } }, "analyses": { "vid_17000001": { "frames": [ {"t": 2.1, "img":"gs://bucket/frames/vid_17000001/f_0021.jpg", "label":"none", "conf":0.81}, {"t": 18.6,"img":"gs://bucket/frames/vid_17000001/f_0186.jpg", "label":"punch", "conf":0.74}, {"t": 36.2,"img":"gs://bucket/frames/vid_17000001/f_0362.jpg", "label":"fight", "conf":0.83} ], "summary": { "topClass":"fight", "timeline":[{"start":16.0,"end":40.0,"class":"fight"}] } } } }
Sample Firebase Security Rules (High-Level)
// Realtime Database Rules (illustrative) { "rules": { ".read": false, ".write": false, "users": { "$uid": { ".read": "$uid === auth.uid", ".write": "$uid === auth.uid" } }, "videos": { "$vid": { ".read": "data.child('owner').val() === auth.uid", ".write": "auth != null && ( !data.exists() || data.child('owner').val() === auth.uid )" } }, "analyses": { "$vid": { ".read": "root.child('videos/'+$vid+'/owner').val() === auth.uid", ".write": "root.child('videos/'+$vid+'/owner').val() === auth.uid" } } } }
Key Features & Benefits
- Explainable output with frame thumbnails and timestamps.
- Fast inference via key framing and on-device TFLite CNN.
- Configurable labels & thresholds for your dataset.
- Offline-first—queue logs and sync when online.
- Secure Firebase Auth + Rules for private projects.
Android Integration Sketch (Java/XML)
// PSEUDO-CODE (illustrative) // 1) Pick Video void pickVideoFromGallery(){ // ACTION_OPEN_DOCUMENT with video/*, persistable URI permission } // 2) Key Framing List<Frame> extractKeyFrames(Uri video){ // Use MediaMetadataRetriever to sample frames every N ms // Apply motion/scene change heuristic to keep representative frames // Return list of (bitmap, timestamp) } // 3) CNN (TFLite) Inference Prediction runModel(Bitmap frame){ // Resize to model input (e.g., 224x224), normalize // Interpreter.run(input, output) // Map logits -> labels {fight, kick, punch, gunshot, none} } // 4) Temporal Smoothing List<SegmentLabel> smooth(List<Prediction> preds){ // Sliding window majority + confidence threshold } // 5) Firebase Save void saveAnalysis(String vidId, List<FrameResult> frames, Summary summary){ // Write to /analyses/{vidId} and upload thumbnails to Storage }
What You Get
Item | Included | Notes |
---|---|---|
Android Source Code (Java/XML) | ✅ | Clean architecture, comments, modular |
Key Framing Engine | ✅ | Configurable sampling & heuristics |
CNN (TFLite) Integration | ✅ | Label mapping, thresholds, smoothing |
Firebase Setup | ✅ | Auth + Realtime DB + Storage + Rules templates |
Demo Video | ✅ | Setup & working walkthrough |
Report & PPT | ✅ | College-format templates |
Support | ✅ | Installation + viva Q&A (1 month) |
FAQs — Violence Detection Android App
Why Students Choose Tour2Tech
300+ projects delivered with top reviews & on-time submissions.
From setup to viva—demo videos, docs, and Q&A support.
Change model, labels, UI, or export formats easily.
Transparent kit + support model with coupon savings.
Project Buying Guide
Discuss Project Requirement
Connect with Yogesh Sir on Call or WhatsApp at +91 9172422245 for a free consultation. Get complete details on development and working.
Create a WhatsApp Group
Add your team to receive weekly updates, project source code, PPTs, and reports.
Advance Payment
Make 45% advance payment; remaining on completion. Invoice shared.
Project Demo & Teaching
Join a live demo with code explanation and recording. Minor changes included.
Installation & Support
We install & set up on your laptop and provide 1 month of support.
What Students Say
Real WhatsApp chats from students after delivery and submission. Add your screenshots below.
Looking for a placement-ready Computer Vision project?
Get the Physical Violence Detection App with code, demo, docs, and support.
WhatsApp Us Now