FaceDetectorYN.fromFile constructor

FaceDetectorYN.fromFile(
  1. String model,
  2. String config,
  3. (int, int) inputSize, {
  4. double scoreThreshold = 0.9,
  5. double nmsThreshold = 0.3,
  6. int topK = 5000,
  7. int backendId = 0,
  8. int targetId = 0,
})

Creates an instance of face detector class with given parameters.

model the path to the requested model

config the path to the config file for compability, which is not requested for ONNX models

inputSize the size of the input image

scoreThreshold the threshold to filter out bounding boxes of score smaller than the given value

nmsThreshold the threshold to suppress bounding boxes of IoU bigger than the given value

topK keep top K bboxes before NMS

backendId the id of backend

targetId the id of target device

https://docs.opencv.org/4.x/df/d20/classcv_1_1FaceDetectorYN.html#a5f7fb43c60c95ca5ebab78483de02516

Implementation

factory FaceDetectorYN.fromFile(
  String model,
  String config,
  (int, int) inputSize, {
  double scoreThreshold = 0.9,
  double nmsThreshold = 0.3,
  int topK = 5000,
  int backendId = 0,
  int targetId = 0,
}) {
  final p = calloc<cvg.FaceDetectorYN>();
  final cModel = model.toNativeUtf8().cast<ffi.Char>();
  final cConfig = config.toNativeUtf8().cast<ffi.Char>();
  cvRun(
    () => cobjdetect.cv_FaceDetectorYN_create(
      cModel,
      cConfig,
      inputSize.cvd.ref,
      scoreThreshold,
      nmsThreshold,
      topK,
      backendId,
      targetId,
      p,
    ),
  );
  calloc.free(cModel);
  calloc.free(cConfig);
  return FaceDetectorYN._(p);
}