Available detectors
MLKit Face Detector
MLKit provides Google’s on-device face detection API with two performance modes:- Fast mode - Used for real-time camera frame detection
- Accurate mode - Used for processing user-selected images
MediaPipe Face Detector
MediaPipe uses the BlazeFace short-range model for face detection. It runs in IMAGE mode and processes both camera frames and static images with the same configuration.Switching detectors
To change the face detection backend, modifyAppModule.kt:15:
AppModule.kt
MLKit configuration
The MLKit detector creates two detector instances inMLKitFaceDetector.kt:20-28:
MLKitFaceDetector.kt
Customizing MLKit options
You can configure additional MLKit options:MediaPipe configuration
The MediaPipe detector uses the BlazeFace short-range model inMediapipeFaceDetector.kt:23-31:
MediapipeFaceDetector.kt
Customizing MediaPipe options
You can adjust MediaPipe detection parameters:Performance comparison
When to use each detector
Use MLKit when:- You need the fastest real-time detection
- Your app targets devices with Google Play Services
- You want to minimize APK size
- You need guaranteed offline functionality
- You’re targeting devices without Google Play Services
- You want consistent performance across modes