schmidt-sebastian commited on
Commit
a9d10f5
·
0 Parent(s):

Initial upload of MediaPipe-ObjectDetector-SSD-MobileNet-V2 from MediaPipe Solutions

Browse files
.gitattributes ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.litertlm filter=lfs diff=lfs merge=lfs -text
12
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
13
+ *.model filter=lfs diff=lfs merge=lfs -text
14
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
15
+ *.npy filter=lfs diff=lfs merge=lfs -text
16
+ *.npz filter=lfs diff=lfs merge=lfs -text
17
+ *.onnx filter=lfs diff=lfs merge=lfs -text
18
+ *.ot filter=lfs diff=lfs merge=lfs -text
19
+ *.parquet filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pdf filter=lfs diff=lfs merge=lfs -text
22
+ *.pickle filter=lfs diff=lfs merge=lfs -text
23
+ *.pkl filter=lfs diff=lfs merge=lfs -text
24
+ *.pt filter=lfs diff=lfs merge=lfs -text
25
+ *.pth filter=lfs diff=lfs merge=lfs -text
26
+ *.rar filter=lfs diff=lfs merge=lfs -text
27
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
28
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
29
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar filter=lfs diff=lfs merge=lfs -text
31
+ *.task filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: litert
4
+ pipeline_tag: object-detection
5
+ tags:
6
+ - mediapipe
7
+ - litert
8
+ - tflite
9
+ - object-detection
10
+ - on-device
11
+ - android
12
+ - ios
13
+ - web
14
+ - python
15
+ - flutter
16
+ - coco
17
+ - ssd
18
+ - mobilenet-v2
19
+ - fp16
20
+ - fp32
21
+ - arxiv:1512.02325
22
+ ---
23
+
24
+ # MediaPipe SSD-MobileNet-V2 (Object Detector)
25
+
26
+ 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).
27
+
28
+ <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;">
29
+ <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>
30
+ <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>
31
+ <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>
32
+ </div>
33
+
34
+ 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.
35
+
36
+ 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]`).
37
+
38
+ For standalone reference, this repository includes the official MediaPipe [`labelmap.txt`](./labelmap.txt) (90 lines, `person` through `toothbrush`).
39
+
40
+ ## Files
41
+
42
+ | File in Repo Root | Upstream Google Path | Precision | Size | SHA-256 |
43
+ |---|---|---|---:|---|
44
+ | [`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` |
45
+ | [`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` |
46
+
47
+ ### Companion Files in Repo Root
48
+
49
+ | File | Role | Size | SHA-256 |
50
+ |---|---|---:|---|
51
+ | [`labelmap.txt`](./labelmap.txt) | Label map | 0.7 KB (661 B) | `f8803ef7900160c629d570848dfda4175e21667bf7b71f73f8ece4938c9f2bf2` |
52
+
53
+ ### Download
54
+
55
+ ```bash
56
+ pip install -U huggingface_hub
57
+ hf download litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 ssd_mobilenet_v2_float16.tflite --local-dir .
58
+ hf download litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2 ssd_mobilenet_v2_float32.tflite --local-dir .
59
+ ```
60
+
61
+ ## Inputs, Outputs, and Model Specifications
62
+
63
+ ### `ssd_mobilenet_v2_float16.tflite`
64
+
65
+ - Embedded `TFLITE_METADATA`: name `ObjectDetector` · version `1` · author `MediaPipe` · packed associated files: `labels.txt`
66
+
67
+ | Direction | Tensor | Shape | Type | Notes |
68
+ |---|---|---|---|---|
69
+ | Input | `serving_default_inputs:0` | `[1, 256, 256, 3]` | `float32` | image — Input image to be processed. — Normalization: `mean=[127.5], std=[127.5]` |
70
+ | Output | `StatefulPartitionedCall:0` | `[1, 12276, 4]` | `float32` | location — The locations of the detected boxes. |
71
+ | Output | `StatefulPartitionedCall:1` | `[1, 12276, 91]` | `float32` | score — The scores of the detected boxes. — Labels: `labels.txt` |
72
+
73
+ ### `ssd_mobilenet_v2_float32.tflite`
74
+
75
+ - Embedded `TFLITE_METADATA`: name `ObjectDetector` · version `1` · author `MediaPipe` · packed associated files: `labels.txt`
76
+
77
+ | Direction | Tensor | Shape | Type | Notes |
78
+ |---|---|---|---|---|
79
+ | Input | `serving_default_inputs:0` | `[1, 256, 256, 3]` | `float32` | image — Input image to be processed. — Normalization: `mean=[127.5], std=[127.5]` |
80
+ | Output | `StatefulPartitionedCall:0` | `[1, 12276, 4]` | `float32` | location — The locations of the detected boxes. |
81
+ | Output | `StatefulPartitionedCall:1` | `[1, 12276, 91]` | `float32` | score — The scores of the detected boxes. — Labels: `labels.txt` |
82
+
83
+ ## Use with MediaPipe Tasks
84
+
85
+ ### Python Quickstart
86
+
87
+ ```bash
88
+ pip install -U mediapipe huggingface_hub
89
+ ```
90
+
91
+ ```python
92
+ import mediapipe as mp
93
+ from huggingface_hub import hf_hub_download
94
+
95
+ model_path = hf_hub_download(
96
+ repo_id="litert-community/MediaPipe-ObjectDetector-SSD-MobileNet-V2",
97
+ filename="ssd_mobilenet_v2_float16.tflite",
98
+ )
99
+
100
+ BaseOptions = mp.tasks.BaseOptions
101
+ ObjectDetector = mp.tasks.vision.ObjectDetector
102
+ ObjectDetectorOptions = mp.tasks.vision.ObjectDetectorOptions
103
+ VisionRunningMode = mp.tasks.vision.RunningMode
104
+
105
+ options = ObjectDetectorOptions(
106
+ base_options=BaseOptions(model_asset_path=model_path),
107
+ running_mode=VisionRunningMode.IMAGE,
108
+ score_threshold=0.5,
109
+ max_results=5,
110
+ )
111
+
112
+ with ObjectDetector.create_from_options(options) as runner:
113
+ mp_image = mp.Image.create_from_file("input.jpg")
114
+ result = runner.detect(mp_image)
115
+ for det in result.detections:
116
+ cat = det.categories[0]
117
+ print(f"{cat.category_name}: {cat.score:.3f} box={det.bounding_box}")
118
+ ```
119
+
120
+ ### Cross-Platform Guides & Samples
121
+
122
+ - **Task overview & options:** [Object Detector documentation](https://developers.google.com/edge/mediapipe/solutions/vision/object_detector)
123
+ - **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)
124
+ - **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)
125
+
126
+ ## Latency Benchmarks
127
+
128
+ 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):
129
+
130
+ | Model Variant | Device | CPU Latency | GPU Latency |
131
+ |---|---|---:|---:|
132
+ | SSD MobileNetV2 (float 16) | Pixel 6 | 37.35 ms | 28.16 ms |
133
+ | SSD MobileNetV2 (float 32) | Pixel 6 | 36.30 ms | 24.01 ms |
134
+
135
+ ## Intended Use, Limitations, and Fairness
136
+
137
+ - **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.
138
+ - **Limitations & considerations:**
139
+ - Closed-vocabulary COCO detector (80 active object classes); objects outside COCO cannot be named.
140
+ - Small objects, heavy occlusion, motion blur, or non-natural camera angles reduce detection recall.
141
+ - Not intended for safety-critical perception (autonomous driving, medical imaging, surveillance) without domain-specific fine-tuning and evaluation.
142
+ - Google does not publish a separate standalone fairness PDF for this model on the MediaPipe documentation page.
143
+
144
+ ## Provenance
145
+
146
+ 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`.
147
+
148
+ | Repo File | Upstream URL | GCS Generation | Upstream `Last-Modified` | Pinned Bucket Version |
149
+ |---|---|---|---|---|
150
+ | `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/` |
151
+ | `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/` |
152
+
153
+ ## License and Citation
154
+
155
+ - License: `apache-2.0` — Distributed under Apache License, Version 2.0 alongside the [MediaPipe](https://github.com/google-ai-edge/mediapipe) release artifacts.
156
+
157
+ ### Citation
158
+
159
+ ```bibtex
160
+ @inproceedings{liu2016ssd,
161
+ title = {SSD: Single Shot MultiBox Detector},
162
+ author = {Liu, Wei and Anguelov, Dragomir and Erhan, Dumitru and Szegedy, Christian and Reed, Scott and Fu, Cheng-Yang and Berg, Alexander C.},
163
+ booktitle = {European Conference on Computer Vision (ECCV)},
164
+ year = {2016},
165
+ url = {https://arxiv.org/abs/1512.02325}
166
+ }
167
+ ```
labelmap.txt ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ person
2
+ bicycle
3
+ car
4
+ motorcycle
5
+ airplane
6
+ bus
7
+ train
8
+ truck
9
+ boat
10
+ traffic light
11
+ fire hydrant
12
+ ???
13
+ stop sign
14
+ parking meter
15
+ bench
16
+ bird
17
+ cat
18
+ dog
19
+ horse
20
+ sheep
21
+ cow
22
+ elephant
23
+ bear
24
+ zebra
25
+ giraffe
26
+ ???
27
+ backpack
28
+ umbrella
29
+ ???
30
+ ???
31
+ handbag
32
+ tie
33
+ suitcase
34
+ frisbee
35
+ skis
36
+ snowboard
37
+ sports ball
38
+ kite
39
+ baseball bat
40
+ baseball glove
41
+ skateboard
42
+ surfboard
43
+ tennis racket
44
+ bottle
45
+ ???
46
+ wine glass
47
+ cup
48
+ fork
49
+ knife
50
+ spoon
51
+ bowl
52
+ banana
53
+ apple
54
+ sandwich
55
+ orange
56
+ broccoli
57
+ carrot
58
+ hot dog
59
+ pizza
60
+ donut
61
+ cake
62
+ chair
63
+ couch
64
+ potted plant
65
+ bed
66
+ ???
67
+ dining table
68
+ ???
69
+ ???
70
+ toilet
71
+ ???
72
+ tv
73
+ laptop
74
+ mouse
75
+ remote
76
+ keyboard
77
+ cell phone
78
+ microwave
79
+ oven
80
+ toaster
81
+ sink
82
+ refrigerator
83
+ ???
84
+ book
85
+ clock
86
+ vase
87
+ scissors
88
+ teddy bear
89
+ hair drier
90
+ toothbrush
ssd_mobilenet_v2_float16.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee21e12bfdc464100c6008c865ab8294f6a04162e6ed2e11986f1175b02cfab2
3
+ size 5918749
ssd_mobilenet_v2_float32.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8ccb1a25d45455ba52e85f26531948e1cb75efeb94c7c3d456d54fd4d6fbdd2
3
+ size 11316189