FaceDetectorYN.fromBuffer constructor

FaceDetectorYN.fromBuffer(
  1. String framework,
  2. Uint8List bufferModel,
  3. Uint8List bufferConfig,
  4. (int, int) inputSize, {
  5. double scoreThreshold = 0.9,
  6. double nmsThreshold = 0.3,
  7. int topK = 5000,
  8. int backendId = 0,
  9. int targetId = 0,
})

Creates an instance of face detector class with given parameters.

framework Name of origin framework

bufferModel A buffer with a content of binary file with weights

bufferConfig A buffer with a content of text file contains network configuration

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#aa0796a4bfe2d4709bef81abbae9a927a

Implementation

factory FaceDetectorYN.fromBuffer(
  String framework,
  Uint8List bufferModel,
  Uint8List bufferConfig,
  (int, int) inputSize, {
  double scoreThreshold = 0.9,
  double nmsThreshold = 0.3,
  int topK = 5000,
  int backendId = 0,
  int targetId = 0,
}) {
  final p = calloc<cobjdetect.FaceDetectorYN>();
  final cFramework = framework.toNativeUtf8().cast<ffi.Char>();
  final bufM = VecUChar.fromList(bufferModel);
  final bufC = VecUChar.fromList(bufferConfig);
  cvRun(
    () => cobjdetect.FaceDetectorYN_NewFromBuffer(
      cFramework,
      bufM.ref,
      bufC.ref,
      inputSize.cvd.ref,
      scoreThreshold,
      nmsThreshold,
      topK,
      backendId,
      targetId,
      p,
    ),
  );
  calloc.free(cFramework);
  bufM.dispose();
  bufC.dispose();
  return FaceDetectorYN._(p);
}