Object Detection
LiteRT
LiteRT
mediapipe
on-device
android
ios
web
python
flutter
coco
ssd
mobilenet-v2
fp16
fp32
Instructions to use litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
|
Download README.md from litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2: direct link, hf CLI and curl.
- Browser
- Download file 10.2 kB
-
https://huggingface.co/litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2/resolve/main/README.md
- Command line
-
hf download hf://litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2/README.md
-
curl -L -o README.md https://huggingface.co/litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2/resolve/main/README.md
10.2 kB
| license: apache-2.0 | |
| library_name: litert | |
| pipeline_tag: object-detection | |
| tags: | |
| - mediapipe | |
| - litert | |
| - tflite | |
| - object-detection | |
| - on-device | |
| - android | |
| - ios | |
| - web | |
| - python | |
| - flutter | |
| - coco | |
| - ssd | |
| - mobilenet-v2 | |
| - fp16 | |
| - fp32 | |
| - arxiv:1512.02325 | |
| # MediaPipe SSD-MobileNet-V2 (Object Detector) | |
| SSD-MobileNet-V2 object detection model(s) (`ssd_mobilenet_v2_float16.tflite` [5.9 MB], `_float32.tflite` [11.3 MB]) trained on COCO (1.5M instances, 80 classes / 90 COCO label slots) and packaged with `TFLITE_METADATA` and embedded labels for the [MediaPipe Object Detector (`ObjectDetector`)](https://developers.google.com/edge/mediapipe/solutions/vision/object_detector) task and [LiteRT](https://developers.google.com/edge/litert). | |
| <div style="border: 1px solid rgba(59, 130, 246, 0.28); background-color: rgba(59, 130, 246, 0.06); border-radius: 8px; padding: 12px 16px; margin: 16px 0;"> | |
| <p style="margin: 0 0 6px 0;"><strong>Documentation:</strong> <a href="https://developers.google.com/edge/mediapipe/solutions/vision/object_detector">MediaPipe Object Detector Docs</a></p> | |
| <p style="margin: 0 0 6px 0;"><strong>Samples:</strong> <a href="https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/object_detection/android">Android</a> · <a href="https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/object_detection/ios">iOS</a> · <a href="https://colab.research.google.com/github/google-ai-edge/mediapipe-samples/blob/main/examples/object_detection/python/object_detector.ipynb">Python Colab</a> · <a href="https://github.com/google-ai-edge/mediapipe-samples-web/blob/main/src/tasks/object-detector.ts">Web</a> · <a href="https://github.com/google/flutter-mediapipe/tree/main/samples/vision/object_detector">Flutter</a></p> | |
| <p style="margin: 0;"><strong>Try live:</strong> <a href="https://google-ai-edge.github.io/mediapipe-samples-web/#/vision/object_detector">Web Demo</a></p> | |
| </div> | |
| SSD-MobileNet-V2 combines a MobileNetV2 backbone with an SSD detection head at `256 x 256` input resolution, prioritizing lower latency and memory footprint over EfficientDet. | |
| Input resolution is `256 x 256` RGB. Unlike EfficientDet-Lite (90 lines), `ssd_mobilenet_v2_*.tflite` embeds a **91-line** `labels.txt` (index `0` is `background`, followed by the 90 COCO slots matching `[1, 12276, 91]`). | |
| For standalone reference, this repository includes the official MediaPipe [`labelmap.txt`](./labelmap.txt) (90 lines, `person` through `toothbrush`). | |
| ## Files | |
| | File in Repo Root | Upstream Google Path | Precision | Size | SHA-256 | | |
| |---|---|---|---:|---| | |
| | [`ssd_mobilenet_v2_float16.tflite`](https://huggingface.co/litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2/blob/main/ssd_mobilenet_v2_float16.tflite) | `object_detector/ssd_mobilenet_v2/float16/latest/ssd_mobilenet_v2.tflite` | `float16` | 5.92 MB (5,918,749 B) | `ee21e12bfdc464100c6008c865ab8294f6a04162e6ed2e11986f1175b02cfab2` | | |
| | [`ssd_mobilenet_v2_float32.tflite`](https://huggingface.co/litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2/blob/main/ssd_mobilenet_v2_float32.tflite) | `object_detector/ssd_mobilenet_v2/float32/latest/ssd_mobilenet_v2.tflite` | `float32` | 11.32 MB (11,316,189 B) | `b8ccb1a25d45455ba52e85f26531948e1cb75efeb94c7c3d456d54fd4d6fbdd2` | | |
| ### Companion Files in Repo Root | |
| | File | Role | Size | SHA-256 | | |
| |---|---|---:|---| | |
| | [`labelmap.txt`](./labelmap.txt) | Label map | 0.7 KB (661 B) | `f8803ef7900160c629d570848dfda4175e21667bf7b71f73f8ece4938c9f2bf2` | | |
| ### Download | |
| ```bash | |
| pip install -U huggingface_hub | |
| hf download litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 ssd_mobilenet_v2_float16.tflite --local-dir . | |
| hf download litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 ssd_mobilenet_v2_float32.tflite --local-dir . | |
| ``` | |
| ## Inputs, Outputs, and Model Specifications | |
| ### `ssd_mobilenet_v2_float16.tflite` | |
| - Embedded `TFLITE_METADATA`: name `ObjectDetector` · version `1` · author `MediaPipe` · packed associated files: `labels.txt` | |
| | Direction | Tensor | Shape | Type | Notes | | |
| |---|---|---|---|---| | |
| | Input | `serving_default_inputs:0` | `[1, 256, 256, 3]` | `float32` | image — Input image to be processed. — Normalization: `mean=[127.5], std=[127.5]` | | |
| | Output | `StatefulPartitionedCall:0` | `[1, 12276, 4]` | `float32` | location — The locations of the detected boxes. | | |
| | Output | `StatefulPartitionedCall:1` | `[1, 12276, 91]` | `float32` | score — The scores of the detected boxes. — Labels: `labels.txt` | | |
| ### `ssd_mobilenet_v2_float32.tflite` | |
| - Embedded `TFLITE_METADATA`: name `ObjectDetector` · version `1` · author `MediaPipe` · packed associated files: `labels.txt` | |
| | Direction | Tensor | Shape | Type | Notes | | |
| |---|---|---|---|---| | |
| | Input | `serving_default_inputs:0` | `[1, 256, 256, 3]` | `float32` | image — Input image to be processed. — Normalization: `mean=[127.5], std=[127.5]` | | |
| | Output | `StatefulPartitionedCall:0` | `[1, 12276, 4]` | `float32` | location — The locations of the detected boxes. | | |
| | Output | `StatefulPartitionedCall:1` | `[1, 12276, 91]` | `float32` | score — The scores of the detected boxes. — Labels: `labels.txt` | | |
| ## Use with MediaPipe Tasks | |
| ### Python Quickstart | |
| ```bash | |
| pip install -U mediapipe huggingface_hub | |
| ``` | |
| ```python | |
| import mediapipe as mp | |
| from huggingface_hub import hf_hub_download | |
| model_path = hf_hub_download( | |
| repo_id="litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2", | |
| filename="ssd_mobilenet_v2_float16.tflite", | |
| ) | |
| BaseOptions = mp.tasks.BaseOptions | |
| ObjectDetector = mp.tasks.vision.ObjectDetector | |
| ObjectDetectorOptions = mp.tasks.vision.ObjectDetectorOptions | |
| VisionRunningMode = mp.tasks.vision.RunningMode | |
| options = ObjectDetectorOptions( | |
| base_options=BaseOptions(model_asset_path=model_path), | |
| running_mode=VisionRunningMode.IMAGE, | |
| score_threshold=0.5, | |
| max_results=5, | |
| ) | |
| with ObjectDetector.create_from_options(options) as runner: | |
| mp_image = mp.Image.create_from_file("input.jpg") | |
| result = runner.detect(mp_image) | |
| for det in result.detections: | |
| cat = det.categories[0] | |
| print(f"{cat.category_name}: {cat.score:.3f} box={det.bounding_box}") | |
| ``` | |
| ### Cross-Platform Guides & Samples | |
| - **Task overview & options:** [Object Detector documentation](https://developers.google.com/edge/mediapipe/solutions/vision/object_detector) | |
| - **Platform setup guides:** [Python](https://developers.google.com/edge/mediapipe/solutions/setup_python) · [Web / JavaScript](https://developers.google.com/edge/mediapipe/solutions/setup_web) · [Android (Kotlin / Java)](https://developers.google.com/edge/mediapipe/solutions/setup_android) · [iOS (Swift)](https://developers.google.com/edge/mediapipe/solutions/setup_ios) · [Flutter (Dart)](https://developers.google.com/edge/mediapipe/solutions/setup_flutter) | |
| - **Runnable sample apps:** [Web Demo](https://google-ai-edge.github.io/mediapipe-samples-web/#/vision/object_detector) · [Web Source](https://github.com/google-ai-edge/mediapipe-samples-web/blob/main/src/tasks/object-detector.ts) · [Android](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/object_detection/android) · [iOS](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/object_detection/ios) · [Python Notebook](https://colab.research.google.com/github/google-ai-edge/mediapipe-samples/blob/main/examples/object_detection/python/object_detector.ipynb) · [Flutter](https://github.com/google/flutter-mediapipe/tree/main/samples/vision/object_detector) | |
| ## Latency Benchmarks | |
| End-to-end MediaPipe Task pipeline average latency reported by the [Object Detector documentation](https://developers.google.com/edge/mediapipe/solutions/vision/object_detector#benchmarks): | |
| | Model Variant | Device | CPU Latency | GPU Latency | | |
| |---|---|---:|---:| | |
| | SSD MobileNetV2 (float 16) | Pixel 6 | 37.35 ms | 28.16 ms | | |
| | SSD MobileNetV2 (float 32) | Pixel 6 | 36.30 ms | 24.01 ms | | |
| ## Intended Use, Limitations, and Fairness | |
| - **Intended applications:** General-purpose multi-object localization and classification across common COCO categories (people, vehicles, animals, household items, food, etc.) in still images, video, and camera streams. | |
| - **Limitations & considerations:** | |
| - Closed-vocabulary COCO detector (80 active object classes); objects outside COCO cannot be named. | |
| - Small objects, heavy occlusion, motion blur, or non-natural camera angles reduce detection recall. | |
| - Not intended for safety-critical perception (autonomous driving, medical imaging, surveillance) without domain-specific fine-tuning and evaluation. | |
| - Google does not publish a separate standalone fairness PDF for this model on the MediaPipe documentation page. | |
| ## Provenance | |
| Every model binary in this repository is byte-identical (unmodified FlatBuffer weights and embedded `TFLITE_METADATA` bytes) to the official artifact served by Google from `storage.googleapis.com/mediapipe-models`. | |
| | Repo File | Upstream URL | GCS Generation | Upstream `Last-Modified` | Pinned Bucket Version | | |
| |---|---|---|---|---| | |
| | `ssd_mobilenet_v2_float16.tflite` | [`ssd_mobilenet_v2.tflite`](https://storage.googleapis.com/mediapipe-models/object_detector/ssd_mobilenet_v2/float16/latest/ssd_mobilenet_v2.tflite) | `1683072060421733` | Wed, 03 May 2023 00:01:00 GMT | `/1/` | | |
| | `ssd_mobilenet_v2_float32.tflite` | [`ssd_mobilenet_v2.tflite`](https://storage.googleapis.com/mediapipe-models/object_detector/ssd_mobilenet_v2/float32/latest/ssd_mobilenet_v2.tflite) | `1683072058863267` | Wed, 03 May 2023 00:00:58 GMT | `/1/` | | |
| ## License and Citation | |
| - License: `apache-2.0` — Distributed under Apache License, Version 2.0 alongside the [MediaPipe](https://github.com/google-ai-edge/mediapipe) release artifacts. | |
| ### Citation | |
| ```bibtex | |
| @inproceedings{liu2016ssd, | |
| title = {SSD: Single Shot MultiBox Detector}, | |
| author = {Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.}, | |
| booktitle = {European Conference on Computer Vision (ECCV)}, | |
| year = {2016}, | |
| url = {https://arxiv.org/abs/1512.02325} | |
| } | |
| ``` | |