View Source Evision.FaceDetectorYN (Evision v0.1.38)

Summary

Types

t()

Type that represents an FaceDetectorYN struct.

Functions

Creates an instance of face detector class with given parameters

Detects faces in the input image. Following is an example output.

Detects faces in the input image. Following is an example output.

getInputSize

getNMSThreshold

getScoreThreshold

getTopK

Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model

Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value

Set the score threshold to filter out bounding boxes of score less than the given value

Set the number of bounding boxes preserved before NMS

Types

@type t() :: %Evision.FaceDetectorYN{ref: reference()}

Type that represents an FaceDetectorYN struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

Link to this function

create(model, config, input_size)

View Source
@spec create(binary(), binary(), {number(), number()}) :: t() | {:error, String.t()}

Creates an instance of face detector class with given parameters

Positional Arguments
  • model: String.

    the path to the requested model

  • config: String.

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

  • input_size: Size.

    the size of the input image

Keyword Arguments
  • score_threshold: float.

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

  • nms_threshold: float.

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

  • top_k: int.

    keep top K bboxes before NMS

  • backend_id: int.

    the id of backend

  • target_id: int.

    the id of target device

Return
  • retval: Evision.FaceDetectorYN.t()

Python prototype (for reference only):

create(model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval
Link to this function

create(model, config, input_size, opts)

View Source
@spec create(binary(), binary(), {number(), number()}, [{atom(), term()}, ...] | nil) ::
  t() | {:error, String.t()}
@spec create(binary(), binary(), binary(), {number(), number()}) ::
  t() | {:error, String.t()}

Variant 1:

create

Positional Arguments
  • framework: String.

    Name of origin framework

  • bufferModel: [uchar].

    A buffer with a content of binary file with weights

  • bufferConfig: [uchar].

    A buffer with a content of text file contains network configuration

  • input_size: Size.

    the size of the input image

Keyword Arguments
  • score_threshold: float.

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

  • nms_threshold: float.

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

  • top_k: int.

    keep top K bboxes before NMS

  • backend_id: int.

    the id of backend

  • target_id: int.

    the id of target device

Return
  • retval: Evision.FaceDetectorYN.t()

Has overloading in C++

Python prototype (for reference only):

create(framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval

Variant 2:

Creates an instance of face detector class with given parameters

Positional Arguments
  • model: String.

    the path to the requested model

  • config: String.

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

  • input_size: Size.

    the size of the input image

Keyword Arguments
  • score_threshold: float.

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

  • nms_threshold: float.

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

  • top_k: int.

    keep top K bboxes before NMS

  • backend_id: int.

    the id of backend

  • target_id: int.

    the id of target device

Return
  • retval: Evision.FaceDetectorYN.t()

Python prototype (for reference only):

create(model, config, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval
Link to this function

create(framework, bufferModel, bufferConfig, input_size, opts)

View Source
@spec create(
  binary(),
  binary(),
  binary(),
  {number(), number()},
  [{atom(), term()}, ...] | nil
) ::
  t() | {:error, String.t()}

create

Positional Arguments
  • framework: String.

    Name of origin framework

  • bufferModel: [uchar].

    A buffer with a content of binary file with weights

  • bufferConfig: [uchar].

    A buffer with a content of text file contains network configuration

  • input_size: Size.

    the size of the input image

Keyword Arguments
  • score_threshold: float.

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

  • nms_threshold: float.

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

  • top_k: int.

    keep top K bboxes before NMS

  • backend_id: int.

    the id of backend

  • target_id: int.

    the id of target device

Return
  • retval: Evision.FaceDetectorYN.t()

Has overloading in C++

Python prototype (for reference only):

create(framework, bufferModel, bufferConfig, input_size[, score_threshold[, nms_threshold[, top_k[, backend_id[, target_id]]]]]) -> retval
@spec detect(t(), Evision.Mat.maybe_mat_in()) ::
  {integer(), Evision.Mat.t()} | {:error, String.t()}

Detects faces in the input image. Following is an example output.

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • image: Evision.Mat.t().

    an image to detect

Return
  • retval: int
  • faces: Evision.Mat.t().detection results stored in a 2D cv::Mat of shape [num_faces, 15]
    • 0-1: x, y of bbox top left corner
    • 2-3: width, height of bbox
    • 4-5: x, y of right eye (blue point in the example image)
    • 6-7: x, y of left eye (red point in the example image)
    • 8-9: x, y of nose tip (green point in the example image)
    • 10-11: x, y of right corner of mouth (pink point in the example image)
    • 12-13: x, y of left corner of mouth (yellow point in the example image)
    • 14: face score

image

Python prototype (for reference only):

detect(image[, faces]) -> retval, faces
Link to this function

detect(self, image, opts)

View Source
@spec detect(t(), Evision.Mat.maybe_mat_in(), [{atom(), term()}, ...] | nil) ::
  {integer(), Evision.Mat.t()} | {:error, String.t()}

Detects faces in the input image. Following is an example output.

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • image: Evision.Mat.t().

    an image to detect

Return
  • retval: int
  • faces: Evision.Mat.t().detection results stored in a 2D cv::Mat of shape [num_faces, 15]
    • 0-1: x, y of bbox top left corner
    • 2-3: width, height of bbox
    • 4-5: x, y of right eye (blue point in the example image)
    • 6-7: x, y of left eye (red point in the example image)
    • 8-9: x, y of nose tip (green point in the example image)
    • 10-11: x, y of right corner of mouth (pink point in the example image)
    • 12-13: x, y of left corner of mouth (yellow point in the example image)
    • 14: face score

image

Python prototype (for reference only):

detect(image[, faces]) -> retval, faces
@spec getInputSize(t()) :: {number(), number()} | {:error, String.t()}

getInputSize

Positional Arguments
  • self: Evision.FaceDetectorYN.t()
Return
  • retval: Size

Python prototype (for reference only):

getInputSize() -> retval
@spec getNMSThreshold(t()) :: number() | {:error, String.t()}

getNMSThreshold

Positional Arguments
  • self: Evision.FaceDetectorYN.t()
Return
  • retval: float

Python prototype (for reference only):

getNMSThreshold() -> retval
@spec getScoreThreshold(t()) :: number() | {:error, String.t()}

getScoreThreshold

Positional Arguments
  • self: Evision.FaceDetectorYN.t()
Return
  • retval: float

Python prototype (for reference only):

getScoreThreshold() -> retval
@spec getTopK(t()) :: integer() | {:error, String.t()}

getTopK

Positional Arguments
  • self: Evision.FaceDetectorYN.t()
Return
  • retval: int

Python prototype (for reference only):

getTopK() -> retval
Link to this function

setInputSize(self, input_size)

View Source
@spec setInputSize(
  t(),
  {number(), number()}
) :: t() | {:error, String.t()}

Set the size for the network input, which overwrites the input size of creating model. Call this method when the size of input image does not match the input size when creating model

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • input_size: Size.

    the size of the input image

Python prototype (for reference only):

setInputSize(input_size) -> None
Link to this function

setNMSThreshold(self, nms_threshold)

View Source
@spec setNMSThreshold(t(), number()) :: t() | {:error, String.t()}

Set the Non-maximum-suppression threshold to suppress bounding boxes that have IoU greater than the given value

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • nms_threshold: float.

    threshold for NMS operation

Python prototype (for reference only):

setNMSThreshold(nms_threshold) -> None
Link to this function

setScoreThreshold(self, score_threshold)

View Source
@spec setScoreThreshold(t(), number()) :: t() | {:error, String.t()}

Set the score threshold to filter out bounding boxes of score less than the given value

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • score_threshold: float.

    threshold for filtering out bounding boxes

Python prototype (for reference only):

setScoreThreshold(score_threshold) -> None
@spec setTopK(t(), integer()) :: t() | {:error, String.t()}

Set the number of bounding boxes preserved before NMS

Positional Arguments
  • self: Evision.FaceDetectorYN.t()

  • top_k: int.

    the number of bounding boxes to preserve from top rank based on score

Python prototype (for reference only):

setTopK(top_k) -> None