File size: 10,377 Bytes
12e1bd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
---
license: apache-2.0
library_name: litert
pipeline_tag: image-classification
datasets:
- imagenet-1k
tags:
- mediapipe
- litert
- tflite
- image-classification
- on-device
- android
- ios
- web
- python
- flutter
- vision
- efficientnet
- efficientnet-lite2
- int8
- fp32
- arxiv:1905.11946
---

# MediaPipe EfficientNet-Lite2 (Image Classifier)

EfficientNet-Lite2 1,000-class ImageNet image classification models in full-integer INT8 (`efficientnet_lite2_int8.tflite`, 7.2 MB) and FP32 (`efficientnet_lite2_float32.tflite`, 24.3 MB), offering higher accuracy than EfficientNet-Lite0 for the [MediaPipe Image Classifier (`ImageClassifier`)](https://developers.google.com/edge/mediapipe/solutions/vision/image_classifier) task and standalone [LiteRT](https://developers.google.com/edge/litert) inference.

<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/image_classifier">MediaPipe Image Classifier 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/image_classification/android">Android</a> · <a href="https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/image_classification/ios">iOS</a> · <a href="https://colab.research.google.com/github/google-ai-edge/mediapipe-samples/blob/main/examples/image_classification/python/image_classifier.ipynb">Python Colab</a> · <a href="https://github.com/google-ai-edge/mediapipe-samples-web/blob/main/src/tasks/image-classifier.ts">Web</a> · <a href="https://github.com/google/flutter-mediapipe/tree/main/samples/vision/image_classifier">Flutter</a></p>
  <p style="margin: 0;"><strong>Try live:</strong> <a href="https://google-ai-edge.github.io/mediapipe-samples-web/#/vision/image_classifier">Web Demo</a></p>
</div>

EfficientNet-Lite2 scales up resolution (`[1, 260, 260, 3]` RGB input) and network capacity over EfficientNet-Lite0 while keeping ReLU6 activations and edge-friendly layers.

### Embedded vs. Standalone Label Files

Both `.tflite` files embed `labels_without_background.txt` (**1,000 classes**, `tench` through `toilet tissue`) inside `TFLITE_METADATA`. The companion [`labels.txt`](./labels.txt) contains **1,001 lines** (line 1 is `background`, lines 2–1001 are the 1,000 ImageNet classes).

## Files

| File in Repo Root | Upstream Google Path | Precision | Size | SHA-256 |
|---|---|---|---:|---|
| [`efficientnet_lite2_int8.tflite`](https://huggingface.co/litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2/blob/main/efficientnet_lite2_int8.tflite) | `image_classifier/efficientnet_lite2/int8/latest/efficientnet_lite2.tflite` | `int8` | 7.17 MB (7,165,461 B) | `7fc3a7dbc1cd2833b162a54577afb47ab531d9c4b799ef11d90a4c56fe4ed5ad` |
| [`efficientnet_lite2_float32.tflite`](https://huggingface.co/litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2/blob/main/efficientnet_lite2_float32.tflite) | `image_classifier/efficientnet_lite2/float32/latest/efficientnet_lite2.tflite` | `float32` | 24.33 MB (24,325,765 B) | `94b6c84a5d6de20f932558de213b50e0338dcc06ab83d8d64b12128a476b4b83` |

### Companion Files in Repo Root

| File | Role | Size | SHA-256 |
|---|---|---:|---|
| [`labels.txt`](./labels.txt) | Label map | 10.5 KB (10,484 B) | `536feacc519de3d418de26b2effb4d75694a8c4c0063e36499a46fa8061e2da9` |

### Download

```bash
pip install -U huggingface_hub
hf download litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2 efficientnet_lite2_int8.tflite --local-dir .
hf download litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2 efficientnet_lite2_float32.tflite --local-dir .
```

## Inputs, Outputs, and Model Specifications

### `efficientnet_lite2_int8.tflite`

- Embedded `TFLITE_METADATA`: name `EfficientNet-lite image classifier (quantized)` · version `1` · author `MediaPipe` · packed associated files: `labels_without_background.txt`

| Direction | Tensor | Shape | Type | Notes |
|---|---|---|---|---|
| Input | `images` | `[1, 260, 260, 3]` | `uint8` | image — Input image to be classified. The expected image is 260 x 260, with three channels (red, blue, and green) per pixel. Each element in the tensor is a value between min and max, where (per-channel) min is [0] and max is [255]. — Normalization: `mean=[127.0], std=[128.0]` — Quantization: `scale=0.0123429, zero_point=125` |
| Output | `Softmax` | `[1, 1000]` | `uint8` | probability — Probabilities of the 1000 labels respectively. — Quantization: `scale=0.00390625, zero_point=0` — Labels: `labels_without_background.txt` |

### `efficientnet_lite2_float32.tflite`

- Embedded `TFLITE_METADATA`: name `EfficientNet-lite image classifier` · version `1` · author `MediaPipe` · packed associated files: `labels_without_background.txt`

| Direction | Tensor | Shape | Type | Notes |
|---|---|---|---|---|
| Input | `images` | `[1, 260, 260, 3]` | `float32` | image — Input image to be classified. The expected image is 260 x 260, with three channels (red, blue, and green) per pixel. Each element in the tensor is a value between min and max, where (per-channel) min is [-0.9921875] and max is [1.0]. — Normalization: `mean=[127.0], std=[128.0]` |
| Output | `Softmax` | `[1, 1000]` | `float32` | probability — Probabilities of the 1000 labels respectively. — Labels: `labels_without_background.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-ImageClassifier-EfficientNet-Lite2",
    filename="efficientnet_lite2_int8.tflite",
)

BaseOptions = mp.tasks.BaseOptions
ImageClassifier = mp.tasks.vision.ImageClassifier
ImageClassifierOptions = mp.tasks.vision.ImageClassifierOptions
VisionRunningMode = mp.tasks.vision.RunningMode

options = ImageClassifierOptions(
    base_options=BaseOptions(model_asset_path=model_path),
    running_mode=VisionRunningMode.IMAGE,
    max_results=5,
)

with ImageClassifier.create_from_options(options) as runner:
    mp_image = mp.Image.create_from_file("input.jpg")
    result = runner.classify(mp_image)
    for category in result.classifications[0].categories:
        print(f"{category.category_name}: {category.score:.3f}")
```

### Cross-Platform Guides & Samples

- **Task overview & options:** [Image Classifier documentation](https://developers.google.com/edge/mediapipe/solutions/vision/image_classifier)
- **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/image_classifier) · [Web Source](https://github.com/google-ai-edge/mediapipe-samples-web/blob/main/src/tasks/image-classifier.ts) · [Android](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/image_classification/android) · [iOS](https://github.com/google-ai-edge/mediapipe-samples/tree/main/examples/image_classification/ios) · [Python Notebook](https://colab.research.google.com/github/google-ai-edge/mediapipe-samples/blob/main/examples/image_classification/python/image_classifier.ipynb) · [Flutter](https://github.com/google/flutter-mediapipe/tree/main/samples/vision/image_classifier)

## Latency Benchmarks

End-to-end MediaPipe Task pipeline average latency reported by the [Image Classifier documentation](https://developers.google.com/edge/mediapipe/solutions/vision/image_classifier#benchmarks):

| Model Variant | Device | CPU Latency | GPU Latency |
|---|---|---:|---:|
| EfficientNet-Lite2 (int8) | Pixel 6 | 19.43 ms | — |
| EfficientNet-Lite2 (float 32) | Pixel 6 | 44.17 ms | 22.20 ms |

## Intended Use, Limitations, and Fairness

- **Intended applications:** Higher-accuracy on-device classification of prominent everyday subjects across the 1,000 ImageNet-1K synsets where additional latency over EfficientNet-Lite0 is acceptable.
- **Limitations & considerations:**
  - Closed-vocabulary ImageNet-1K classifier; assumes a centered dominant subject inside a `260 x 260` crop.
  - Not intended for safety-critical, medical, or biometric decisions without domain-specific fine-tuning.
  - Google does not publish a separate standalone fairness PDF for EfficientNet-Lite2 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 |
|---|---|---|---|---|
| `efficientnet_lite2_int8.tflite` | [`efficientnet_lite2.tflite`](https://storage.googleapis.com/mediapipe-models/image_classifier/efficientnet_lite2/int8/latest/efficientnet_lite2.tflite) | `1682480012152147` | Wed, 26 Apr 2023 03:33:32 GMT | `/1/` |
| `efficientnet_lite2_float32.tflite` | [`efficientnet_lite2.tflite`](https://storage.googleapis.com/mediapipe-models/image_classifier/efficientnet_lite2/float32/latest/efficientnet_lite2.tflite) | `1682480010617750` | Wed, 26 Apr 2023 03:33:30 GMT | `/1/` |

## License and Citation

- License: `apache-2.0` — Stated as Apache License, Version 2.0 (`http://www.apache.org/licenses/LICENSE-2.0`) in the embedded `TFLITE_METADATA` block of the `.tflite` model file(s).

### Citation

```bibtex
@inproceedings{tan2019efficientnet,
  title     = {EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks},
  author    = {Tan, Mingxing and Le, Quoc V.},
  booktitle = {International Conference on Machine Learning (ICML)},
  year      = {2019},
  url       = {https://arxiv.org/abs/1905.11946}
}
```