Skip to main content

Options

There are various options you can provide to the face detector to customize its behavior. Here's an example of what's possible:

import {
RNMLKitFaceDetectorOptions,
RNMLKitFaceDetectionContextProvider
} from "@infinitered/react-native-mlkit-face-detection";

const CUSTOM_OPTIONS: RNMLKitFaceDetectorOptions = {
performanceMode: "accurate", //
detectLandmarks: true,
runClassifications: true,
minFaceSize: 0.01,
isTrackingEnabled: true,
};

function App() {
return (
<RNMLKitFaceDetectionContextProvider options={CUSTOM_OPTIONS}>
{/* rest of your app goes here */}
</RNMLKitFaceDetectionContextProvider>
);
}

Available Options

Options for the face detector.

PropertyDescriptionTypeDefault
performanceModeThe performance mode for the detector. Determines the trade-off between speed and accuracy. Use 'fast' for real-time applications where speed is critical, and 'accurate' for applications where higher accuracy is desired at the expense of speed.'fast' | 'accurate'accurate
landmarkModeIndicates if landmark detection should be enabled.boolean | nullnull
contourModeIndicates if contour detection should be enabled.boolean | nullnull
classificationModeIndicates if classification mode should be enabled.boolean | nullnull
minFaceSizeMinimum size of the face for detection.number | nullnull
isTrackingEnabledIndicates if tracking should be enabled for detected faces.boolean | nullnull