An advanced, high-performance Android application featuring real-time object detection using a customized YOLO26n (float32) model powered by TensorFlow Lite. Implemented with a sleek Sci-Fi HUD overlay and a clean Neumorphic design system, YoloDetector delivers desktop-grade edge computing on mobile devices.
YoloDetector is an educational Android application that demonstrates how to deploy modern YOLO object detection models entirely on-device using TensorFlow Lite.
The project is designed for:
- Android developers learning AI
- Students exploring Edge AI
- Researchers deploying custom YOLO models
- Developers building offline computer vision applications.
- Real-Time Camera Detection: Powered by Android Jetpack CameraX, capturing live frames and conducting inference with negligible latency.
- Static Photo Analyzer: Feed images from your gallery or take a new picture using the system camera, and instantly see overlay boxes and confidence scores.
- Sci-Fi HUD Interface: The camera view utilizes a specialized HUD aesthetic complete with edge glow, custom wireframes, and live diagnostic readouts.
- GPU Acceleration: Automated hardware delegate configuration. The app scans device compatibility and selects the TFLite GPU Delegate for rapid inference, falling back to CPU multi-threading (4 threads) if unavailable.
- Advanced Camera Controls: Fully integrated pinch-to-zoom gestures, a manual zoom slider, precise increment/decrement buttons, and a front/back camera toggle.
- COCO dataset ready: Supports the detection of 80 standard classes, from people and vehicles to household electronics.
- Neumorphic Dashboard: Modern, soft-shadow neumorphic UI cards on the landing screen, incorporating interactive states for a highly responsive, premium feel.
| Dashboard (Neumorphic) | Live Detection (Sci-Fi HUD) | Photo Analyzer |
|---|---|---|
![]() |
![]() |
![]() |
(Place screenshots in assets/ to display them here)
The project is structured under a clean modular architecture:
graph TD
A[MainActivity] -->|Real-Time Mode| B[CameraActivity]
A[MainActivity] -->|Photo Mode| C[PhotoDetectActivity]
B -->|Frames| D[YoloDetector]
C -->|Images| D
D -->|TFLite Inference| E[yolo26n_float32.tflite]
E -->|Bounding Boxes| D
D -->|Detections & Latency| F[OverlayView / HUD]
-
Model Input: Bounded RGB float32 normalized image of size
$640 \times 640 \times 3$ . -
Non-Maximum Suppression (NMS): Handled directly within the TFLite graph (end-to-end export) yielding a
[1, 300, 6]tensor output[x1, y1, x2, y2, confidence, class_id]. - Coordinate Scaling: Dynamic viewport transformations scale normalized coordinates to fit screen boundaries regardless of device aspect ratio.
- Non-Blocking Execution: Configured using
ImageAnalysis.STRATEGY_KEEP_ONLY_LATESTto drop old frames if the inference engine is busy, guaranteeing zero lag in the live viewfinder. - Format Conversion: Custom conversion converts the native
RGBA_8888ImageProxyplane into an AndroidBitmapwhile accounting for row stride padding (rowPadding = rowStride - pixelStride * width). - Rotation Correction: Matches physical camera orientation to output canvas by querying sensor rotation (
imageProxy.imageInfo.rotationDegrees) and applying aMatrixpost-rotation translation.
-
Byte Normalization: Preallocates a direct JVM
ByteBuffermapping 4 bytes per float:$$\text{Buffer Size} = 1 \text{ (batch)} \times 640 \text{ (width)} \times 640 \text{ (height)} \times 3 \text{ (channels)} \times 4 \text{ (bytes/float)}$$ -
Standardized Scaling: Isolates RGB pixel channels using bit shifts and normalizes color values to
$[0.0, 1.0]$ :$$R_{norm} = \frac{(px \text{ shr } 16) \text{ and } 0xFF}{255.0f}$$ -
SoC Accelerators: Dynamically interrogates the system CPU using
CompatibilityList.isDelegateSupportedOnThisDeviceto allocateGpuDelegatefor high-performance hardware execution, defaulting to 4 background CPU execution threads if incompatible.
- Canvas Mapping: Custom
OverlayViewtranslates relative coordinates ([0.0, 1.0]) into the actual rendering viewport, scaling and centering bounding boxes to avoid aspect-ratio distortion. - HUD Reactive Animation: Highlights successful object identification by firing alpha animation pulses (
edgeGlow.animate().alpha(0f).setDuration(300)) onto the custom red/green neon dashboard edge layout.
- Android Studio Jellyfish (or newer)
- Gradle JDK 17+
- Physical Android device running API 24 (Nougat) or higher (strongly recommended for CameraX and GPU delegate functionality)
- Clone the Repository:
git clone https://github.com/shivamprasad1001/YoloDetector.git cd YoloDetector - Open in Android Studio:
- File -> Open -> Select the cloned
YoloDetectorroot folder.
- File -> Open -> Select the cloned
- Sync Gradle:
- Wait for Gradle Sync to complete and download TFLite/CameraX dependencies.
- Run the Project:
- Connect your Android device via USB/Wi-Fi debugging and press
Run.
- Connect your Android device via USB/Wi-Fi debugging and press
This app leverages state-of-the-art Jetpack libraries and ML engines:
- TensorFlow Lite (
org.tensorflow:tensorflow-lite:2.14.0): Efficient machine learning runtime on mobile devices. - TFLite GPU Delegate (
org.tensorflow:tensorflow-lite-gpu:2.14.0): Empowers high-speed GPU pipeline processing. - CameraX API (
androidx.camera): Flexible camera API that handles resolution matching, rotation, and lifecycle state management automatically. - ViewBinding: Simplifies layout binding and eradicates boilerplate code.
Developed and maintained by Shivam Prasad.
- π Website & Portfolio: shivamprasad1001.in
- π GitHub: @shivamprasad1001
This project is licensed under the MIT License - see the LICENSE file for details.



