Instructions to use litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/MediaPipe-ImageClassifier-EfficientNet-Lite2 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
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) task and standalone LiteRT inference.
Documentation: MediaPipe Image Classifier Docs
Samples: Android · iOS · Python Colab · Web · Flutter
Try live: Web Demo
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 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 |
image_classifier/efficientnet_lite2/int8/latest/efficientnet_lite2.tflite |
int8 |
7.17 MB (7,165,461 B) | 7fc3a7dbc1cd2833b162a54577afb47ab531d9c4b799ef11d90a4c56fe4ed5ad |
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 |
Label map | 10.5 KB (10,484 B) | 536feacc519de3d418de26b2effb4d75694a8c4c0063e36499a46fa8061e2da9 |
Download
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: nameEfficientNet-lite image classifier (quantized)· version1· authorMediaPipe· 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: nameEfficientNet-lite image classifier· version1· authorMediaPipe· 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
pip install -U mediapipe huggingface_hub
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
- Platform setup guides: Python · Web / JavaScript · Android (Kotlin / Java) · iOS (Swift) · Flutter (Dart)
- Runnable sample apps: Web Demo · Web Source · Android · iOS · Python Notebook · Flutter
Latency Benchmarks
End-to-end MediaPipe Task pipeline average latency reported by the Image Classifier documentation:
| 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 260crop. - 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.
- Closed-vocabulary ImageNet-1K classifier; assumes a centered dominant subject inside a
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 |
1682480012152147 |
Wed, 26 Apr 2023 03:33:32 GMT | /1/ |
efficientnet_lite2_float32.tflite |
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 embeddedTFLITE_METADATAblock of the.tflitemodel file(s).
Citation
@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}
}
- Downloads last month
- -