modules

package
v0.0.0-...-c4818f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCenterFace

func GetCenterFace(detFaces []*tensor.Dense, h, w *int, center *DimensionPair[int]) (*tensor.Dense, int, error)

GetCenterFace returns the center face and its index from a list of images.

Types

type DimensionPair

type DimensionPair[T int | int8 | int16 | int32 | int64 | float32 | float64] struct {
	Width  T
	Height T
}

type FaceAntiSpoofingClient

type FaceAntiSpoofingClient struct {
	ModelParams *config.FaceAntiSpoofingParams
	ModelConfig *triton_proto.ModelConfigResponse
	// contains filtered or unexported fields
}

func (*FaceAntiSpoofingClient) InferSingle

func (c *FaceAntiSpoofingClient) InferSingle(imgFar, imgMid, imgNear gocv.Mat) (float32, error)

type FaceDetectionClient

type FaceDetectionClient struct {
	ModelConfig *triton_proto.ModelConfigResponse
	ModelParams *config.FaceDetectionParams
	// contains filtered or unexported fields
}

func (*FaceDetectionClient) InferBatch

func (c *FaceDetectionClient) InferBatch(rawInputTensors [][]gocv.Mat) ([][]config.FaceDetectionOutput, error)

func (*FaceDetectionClient) InferSingle

func (c *FaceDetectionClient) InferSingle(rawInputTensors []gocv.Mat) ([]config.FaceDetectionOutput, error)

type FaceHelperClient

type FaceHelperClient struct {
	// contains filtered or unexported fields
}

func NewFaceHelperClient

func NewFaceHelperClient(
	tritonClient *gotritonclient.TritonGRPCClient,
	faceSize,
	fasSize,
	faSize int,
	faceTemplate,
	fasTemplate,
	faTemplate *tensor.Dense,
) (*FaceHelperClient, error)

NewFaceHelperClient initializes a new FaceHelperClient.

func (*FaceHelperClient) AlignFASFace

func (c *FaceHelperClient) AlignFASFace(img gocv.Mat, landmark *tensor.Dense, borderMode *gocv.BorderType) (gocv.Mat, gocv.Mat, error)

AlignFASFace aligns input image using input landmark and face anti-spoofing template.

Inputs:

  • inputImgs (gocv.Mat): face image.
  • landmarks (*tensor.Dense): face landmark.

Outputs:

  • croppedFace (gocv.Mat): cropped face.
  • affineMatrix (gocv.Mat): affine matrix.

func (*FaceHelperClient) AlignFASFaces

func (c *FaceHelperClient) AlignFASFaces(inputImgs []gocv.Mat, landmarks []*tensor.Dense, borderMode *gocv.BorderType) ([]gocv.Mat, []gocv.Mat, error)

AlignFASFaces aligns input images using input landmarks and face anti-spoofing template.

Inputs:

  • inputImgs ([]gocv.Mat): list of face images.
  • landmarks ([]*tensor.Dense): list of face landmarks.

Outputs:

  • croppedFaces ([]gocv.Mat): list of cropped faces.
  • affineMatrices ([]gocv.Mat): list of affine matrices.

func (*FaceHelperClient) AlignFaceIDCard

func (c *FaceHelperClient) AlignFaceIDCard(img gocv.Mat, lmk, bbox *tensor.Dense, borderMode *gocv.BorderType) (gocv.Mat, gocv.Mat, error)

AlignFaceIDCard crops and aligns the face roi in the input image.

Inputs:

  • img (gocv.Mat): face image.
  • lmk (*tensor.Dense): face landmark.
  • lmk (*tensor.Dense): face bounding box.

Outputs:

  • croppedFace (gocv.Mat): cropped face.
  • affineMatrix (gocv.Mat): affine matrix.

func (*FaceHelperClient) AlignWarpFace

func (c *FaceHelperClient) AlignWarpFace(img gocv.Mat, landmark *tensor.Dense, borderMode *gocv.BorderType) (gocv.Mat, gocv.Mat, error)

AlignWarpFace aligns input image using input landmark and face template.

Inputs:

  • inputImgs (gocv.Mat): face image.
  • landmarks (*tensor.Dense): face landmark.

Outputs:

  • croppedFace (gocv.Mat): cropped face.
  • affineMatrix (gocv.Mat): affine matrix.

func (*FaceHelperClient) AlignWarpFaces

func (c *FaceHelperClient) AlignWarpFaces(inputImgs []gocv.Mat, landmarks []*tensor.Dense, borderMode *gocv.BorderType) ([]gocv.Mat, []gocv.Mat, error)

AlignWarpFaces aligns input images using input landmarks and face template.

Inputs:

  • inputImgs ([]gocv.Mat): list of face images.
  • landmarks ([]*tensor.Dense): list of face landmarks.

Outputs:

  • croppedFaces ([]gocv.Mat): list of cropped faces.
  • affineMatrices ([]gocv.Mat): list of affine matrices.

func (*FaceHelperClient) GetFaceLandmarks5

func (c *FaceHelperClient) GetFaceLandmarks5(
	batchImages []gocv.Mat,
	keepLargest,
	keepCenter *bool,
	scoreThreshold,
	eyeDistanceThreshold *float32,
	tryPadding *bool,
) ([]*tensor.Dense, []*tensor.Dense, error)

GetFaceLandmarks5 processes the input images and return the (5,2) Matrix of facial landmarks.

func (*FaceHelperClient) SwapRGB

func (c *FaceHelperClient) SwapRGB(srcMat gocv.Mat) gocv.Mat

func (*FaceHelperClient) SwapRGBs

func (c *FaceHelperClient) SwapRGBs(batchImages []gocv.Mat) []gocv.Mat

type FaceIDClient

type FaceIDClient struct {
	ModelParams *config.FaceIDParams
	ModelConfig *triton_proto.ModelConfigResponse
	// contains filtered or unexported fields
}

func (*FaceIDClient) InferBatch

func (c *FaceIDClient) InferBatch(rawInputTensors [][]gocv.Mat) ([]*tensor.Dense, error)

type FaceQualityClient

type FaceQualityClient struct {
	ModelParams *config.FaceQualityParams
	ModelConfig *triton_proto.ModelConfigResponse
	// contains filtered or unexported fields
}

func (*FaceQualityClient) InferBatch

func (c *FaceQualityClient) InferBatch(rawInputTensors [][]gocv.Mat) ([]*tensor.Dense, error)

func (*FaceQualityClient) InferSingle

func (c *FaceQualityClient) InferSingle(rawInputTensors []gocv.Mat) ([]*tensor.Dense, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL