Using MobileNet v3 for Object Detection in TensorFlow Lite
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
Introduction
MobileNet v3 is a lightweight neural network architecture optimized for mobile and edge devices. Combined with TensorFlow Lite, it enables real-time object detection on smartphones, IoT devices, and embedded systems with minimal latency and power consumption. MobileNet v3 comes in two variants — Large (higher accuracy) and Small (faster, lower memory) — both suitable for TFLite deployment.
Getting a MobileNet v3 TFLite Model
Option 1: TensorFlow Hub (Pre-trained)
Option 2: TensorFlow Model Zoo
Download from the TensorFlow Model Garden:
Option 3: Convert a SavedModel to TFLite
Running Inference with Python
Android Deployment
Add TFLite Dependency
Kotlin Inference Code
Quantization for Better Performance
Quantize the model for faster inference on mobile:
| Quantization | Model Size | Speed | Accuracy |
| Float32 | ~25 MB | Baseline | Best |
| Float16 | ~12 MB | ~1.5x faster | Near-identical |
| INT8 | ~6 MB | ~2-3x faster | Slight loss |
Real-World Applications
- Real-Time Video Analysis: Detect and classify objects in camera feeds on mobile devices
- IoT Devices: Deploy on smart cameras, drones, and robotics for edge inference
- Mobile Applications: Enable apps to recognize products, read text, or identify objects offline
- Retail: Shelf monitoring, checkout-free shopping, and inventory tracking
Common Pitfalls
- Input size mismatch: MobileNet v3 models expect specific input sizes (typically 320x320 or 224x224). Resize images to match
input_details[0]['shape']exactly. - Output tensor order: Different TFLite models may order output tensors differently (boxes, classes, scores, count). Always check
output_detailsrather than hardcoding indices. - Quantization calibration: INT8 quantization requires a representative dataset that covers your actual input distribution. Random data for calibration produces poor accuracy.
- NNAPI/GPU delegate: Enable hardware acceleration on Android with
Interpreter.Options().addDelegate(NnApiDelegate())for 2-5x speedup, but test compatibility as not all ops are supported. - COCO class IDs: Pre-trained models use COCO dataset class IDs (1-90, not 0-89). Map IDs to labels using the COCO label file.
Summary
- MobileNet v3 + TFLite enables real-time object detection on mobile and edge devices
- Use pre-trained models from TF Hub or Model Zoo, or convert your own with
TFLiteConverter - Quantize to INT8 for 2-3x speed improvement with minimal accuracy loss
- Always verify input size and output tensor order from the model's metadata
- Enable GPU/NNAPI delegates on Android for hardware-accelerated inference
Related reading
- Using pre-trained inception_resnet_v2 with Tensorflow
- Using pre-trained Inception_v4 model
- Using pre-trained word2vec with LSTM for word generation
- Using pure numpy metric as metric in Keras/TensorFlow
- Using sample_weights with fit_generator
- Using sparse matrices with Keras and Tensorflow
- Using Python''s PIL, how do I enhance the contrast/saturation of an image?
- Using tensorflow to identify lego bricks?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.