FaceDetectionService constructor

FaceDetectionService(
  1. Interpreter interpreter,
  2. List<int> inputShape,
  3. List<List<int>> outputsShapes
)

Creates a FaceDetectionService from interpreter containing tflite model to detect face on image.

Sets inputShape, outputShapes and outputTypes from interpreter

Implementation

FaceDetectionService(this.interpreter, this.inputShape, this.outputsShapes) {
  final anchorOption = AnchorOption(
      inputSizeHeight: 128,
      inputSizeWidth: 128,
      minScale: 0.1484375,
      maxScale: 0.75,
      anchorOffsetX: 0.5,
      anchorOffsetY: 0.5,
      numLayers: 4,
      featureMapHeight: [],
      featureMapWidth: [],
      strides: [8, 16, 16, 16],
      aspectRatios: [1.0],
      reduceBoxesInLowestLayer: false,
      interpolatedScaleAspectRatio: 1.0,
      fixedAnchorSize: true);
  try {
    _anchors = generateAnchors(anchorOption);
  } catch (e) {
    logger.severe('Error while generating anchors: $e');
  }
}