A powerful Android application that provides real-time object detection using state-of-the-art AI models. The app combines SSD MobileNet v1 for live camera detection and YOLOv5s for high-accuracy image analysis, delivering professional-grade object detection capabilities on mobile devices.
- Real-time Object Detection: Live camera feed with instant object recognition
- Dual AI Models:
- SSD MobileNet v1 (TensorFlow Lite) for live camera detection
- YOLOv5s (TensorFlow Lite) for uploaded image analysis
- 80 COCO Object Classes: Detects people, vehicles, animals, household items, and more
- High Performance: Optimized for mobile devices with GPU acceleration support
- Full-Screen Immersive Mode: Distraction-free detection experience
- Live Camera Preview: Real-time video feed with overlay detection boxes
- FPS Counter: Performance monitoring with frames-per-second display
- Status Indicators: Visual feedback for detection state
- Smooth Animations: Professional splash screen with elegant transitions
- Front/Back Camera Switching: Toggle between cameras with one tap
- Flash Control: Toggle camera flash for better visibility
- Auto-Focus: Automatic focus adjustment for optimal detection
- Aspect Ratio Handling: Proper scaling and cropping for different screen sizes
- Image Upload: Select and analyze photos from gallery
- Batch Processing: Process multiple images with detailed results
- Confidence Scoring: Percentage-based confidence indicators
- Bounding Box Visualization: Clear object location highlighting
- Android 7.0 (API 24) or higher
- Camera permission (automatically requested)
- Storage permission (for image uploads)
- Minimum 2GB RAM recommended for optimal performance
- Android Studio (latest version)
- Android SDK (API 24+)
- Gradle 8.1.4+
- Kotlin 1.9.10+
-
Clone the Repository:
git clone https://github.com/indra057/realtime_object_detection.git cd realtime_object_detection-main -
Open in Android Studio:
- Launch Android Studio
- Select
Open an existing project - Navigate to the cloned folder and open it
-
Sync Dependencies:
- Android Studio will automatically sync Gradle dependencies
- Wait for the sync to complete
-
Build the Project:
./gradlew assembleDebug
Or use Android Studio's
BuildโBuild Bundle(s) / APK(s)โBuild APK(s) -
Install on Device:
- Connect your Android device via USB
- Enable
Developer OptionsandUSB Debugging - Run
./gradlew installDebugor use Android Studio's run button
-
Launch and Enjoy:
- Open the app from your device
- Allow camera permissions
- Start detecting objects!
- SSD MobileNet v1: 300x300 input, optimized for real-time detection
- YOLOv5s: 320x320 input, high-accuracy detection for static images
- TensorFlow Lite: Mobile-optimized inference engine
- GPU Acceleration: Automatic GPU delegate when available
- Detection Speed: 15-30 FPS on modern devices
- Model Size: ~14MB total (both models)
- Memory Usage: ~100-200MB during operation
- Battery Impact: Optimized for minimal battery drain
People & Animals: person, cat, dog, horse, cow, sheep, bird, etc. Vehicles: car, truck, bus, motorcycle, bicycle, airplane, boat, etc. Household Items: chair, couch, bed, table, tv, laptop, phone, etc. Food & Drinks: apple, banana, pizza, cake, bottle, cup, etc. Sports & Recreation: sports ball, tennis racket, skateboard, etc.
- Launch the app - Grant camera permissions
- Point camera at objects you want to detect
- View results - Objects are highlighted with colored boxes
- Check confidence - Percentage scores show detection accuracy
- Switch cameras - Use the camera switch button for front/back
- Toggle flash - Use flash button for better lighting
- Tap upload button - Select image from gallery
- Wait for processing - YOLOv5s analyzes the image
- View results - Detailed detection with bounding boxes
- Tap image - Return to camera view
- ๐ฆ Flash Button: Toggle camera flash on/off
- ๐ท Camera Switch: Switch between front and back cameras
- ๐ค Upload Button: Select image for analysis
- โน๏ธ Info Button: View app information and features
Example 1 - Street Scene Detection:
Original Image |
With Object Detection |
Detecting cars, people, and traffic elements with confidence scores
Example 2 - Outdoor Scene Detection:
- Live Camera Detection: Real-time bounding boxes with confidence scores
- FPS Counter: Performance monitoring during detection
- Status Indicators: Visual feedback for detection state
- Control Buttons: Flash, camera switch, upload, and settings
- Full-Screen Mode: Immersive detection experience
Demo Features:
- App launch and splash screen animation
- Live camera detection demonstration
- Image upload and analysis process
- Camera switching and flash control
- Performance metrics and FPS display
- Real-time bounding box detection
Camera Not Working:
- Ensure camera permissions are granted
- Restart the app if camera fails to initialize
- Check if another app is using the camera
Slow Performance:
- Close other apps to free up memory
- Ensure device has sufficient RAM (2GB+)
- Try restarting the device
Detection Accuracy Issues:
- Ensure good lighting conditions
- Hold device steady for better results
- Clean camera lens for clearer images
App Crashes:
- Check Android version compatibility (7.0+)
- Clear app data and restart
- Reinstall the app if issues persist
For Better FPS:
- Close background applications
- Enable GPU acceleration in device settings
- Use release build for production
For Better Accuracy:
- Ensure good lighting
- Hold device steady
- Use back camera for better quality
app/
โโโ src/main/
โ โโโ java/com/programminghut/realtime_object/
โ โ โโโ MainActivity.kt # Main detection logic
โ โ โโโ SplashActivity.kt # Splash screen
โ โ โโโ Yolov5TFLiteDetector.java # YOLOv5 implementation
โ โ โโโ Recognition.java # Detection result model
โ โโโ ml/ # AI models
โ โ โโโ ssd_mobilenet_v1_1_metadata_1.tflite
โ โ โโโ yolov5s-fp16.tflite
โ โโโ assets/ # Labels and resources
โ โโโ labels.txt # SSD MobileNet labels
โ โโโ coco_label.txt # YOLOv5 COCO labels
- TensorFlow Lite:
org.tensorflow:tensorflow-lite-support:0.4.4 - TensorFlow Lite GPU:
org.tensorflow:tensorflow-lite-gpu:2.13.0 - AndroidX: Core Android libraries
- Material Design: UI components
๐ Training Documentation: For detailed model training guides, see MODEL_TRAINING.md
Quick Steps:
- Train your model using TensorFlow/PyTorch
- Convert to TensorFlow Lite format
- Replace model files in
app/src/main/ml/ - Update labels in
app/src/main/assets/ - Rebuild the app
Note: Custom model training documentation is currently under development. The app works with pre-trained models out of the box.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you encounter any issues or have questions:
- Check the troubleshooting section above
- Search existing issues in the repository
- Create a new issue with detailed information
- Include device information and error logs
- TensorFlow Team for the amazing TensorFlow Lite framework
- COCO Dataset for object detection labels
- YOLOv5 Community for the detection model
- Android Community for development resources
This project was built with help from following tutorials:
- SSD MobileNet Implementation: Real-time Object Detection with SSD MobileNet
- YOLOv5 Implementation: YOLOv5 Android Tutorial
Special thanks to the tutorial creators for their comprehensive guides that made this project possible!
- Initial release
- Real-time camera detection with SSD MobileNet v1
- Image upload analysis with YOLOv5s
- Full-screen immersive interface
- Camera switching and flash control
- FPS monitoring and performance optimization
Made with โค๏ธ for the Android community
Transform your device into a powerful object detection tool with this professional-grade application!





