loadModel static method

void loadModel(
  1. String? modelPath,
  2. FaceModel faceModel,
  3. ProcessingUnit processingUnit
)

Loads a specified AI model into memory from the specified directory.

param modelPath The path to directory containing the AI model files. param faceModel The AI model to be loaded. param processingUnit The processing unit to be used. throws FaceException An error has occurred during Face Library execution.

Implementation

static void loadModel(String? modelPath, FaceModel faceModel, ProcessingUnit processingUnit) {
  Pointer<Char>? pModelPath = modelPath?.toNativeUtf8().cast<Char>();
  try {
    var err = faceSDK.id3FaceLibrary_LoadModel(pModelPath ?? nullptr, faceModel.value, processingUnit.value);
    if (err != FaceError.success.value) {
      throw FaceException(err);
    }
  } finally {
    if (pModelPath != null) {
      calloc.free(pModelPath);
    }
  }
}