create static method

Future<FaceLandmark> create({
  1. InterpreterOptions? options,
  2. PerformanceConfig? performanceConfig,
})

Creates and initializes a face landmark (mesh) model instance.

This factory method loads the 468-point face mesh TensorFlow Lite model from package assets and prepares it for inference. The face mesh provides detailed 3D geometry of facial features.

The options parameter allows you to customize the TFLite interpreter configuration (e.g., number of threads, use of GPU delegate).

The performanceConfig parameter enables hardware acceleration delegates. Use PerformanceConfig.xnnpack() for 2-5x speedup on CPU. If both options and performanceConfig are provided, options takes precedence.

Returns a fully initialized FaceLandmark instance ready to predict face meshes.

Note: This model expects an aligned face crop as input. For full pipeline processing, use the high-level FaceDetector class instead.

Example:

// Default (auto mode)
final landmarkModel = await FaceLandmark.create();
final meshPoints = await landmarkModel.call(alignedFaceCropMat);

// With XNNPACK acceleration
final landmarkModel = await FaceLandmark.create(
  performanceConfig: PerformanceConfig.xnnpack(),
);

Throws StateError if the model cannot be loaded or initialized.

Implementation

static Future<FaceLandmark> create({
  InterpreterOptions? options,
  PerformanceConfig? performanceConfig,
}) => _createWithLoader(
  load: (opts) => Interpreter.fromAsset(
    'packages/face_detection_tflite/assets/models/$kFaceLandmarkModel',
    options: opts,
  ),
  options: options,
  performanceConfig: performanceConfig,
);