This sample demonstrates the MediaPipe Object Detector task in a Jetpack Compose Material 3 app (consolidating the legacy Views and Jetpack Compose Android variants). It supports:
- Camera: Live front/back CameraX feed with real-time bounding boxes, category labels, and inference telemetry.
- Gallery: Bundled dining sample (
Try sample) as well as user-selected images and videos from the device gallery.
In the Settings sheet, you can switch models (EfficientDet Lite0 and EfficientDet Lite2), toggle hardware Delegate (CPU or GPU), change Max results (1, 3, 5), and tune the Confidence threshold.
- Android Studio (with Android SDK 36 and JDK 17+)
- An Android device or emulator running Android 9.0 (API 28) or higher
The Gradle script app/download_models.gradle.kts automatically downloads and SHA-256 verifies efficientdet-lite0.tflite and efficientdet-lite2.tflite into app/src/main/assets/ before building:
./gradlew :app:verifyModels :app:assembleDebugTo run the shared unit tests and instrumented real-model + UI tests:
./gradlew :android-common:testing:testDebugUnitTest :app:connectedDebugAndroidTest