model

package
v0.0.0-...-8b6d769 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Argmax

func Argmax(slice []float32) int

Argmax return the index of the maximum value in a slice

func BytesToFloat32Slice

func BytesToFloat32Slice(data []byte) ([]float32, error)

func CalcFaceDistance

func CalcFaceDistance(faceEmbedding, referenceFaceEmbedding []float32) float64

CalcFaceDistance to calculate the distance between two face embeddings

func CalculateMean2f

func CalculateMean2f(points []gocv.Point2f) gocv.Point2f

CalculateMean2f calculates the mean of a slice of gocv.Point2f

func ClipMat

func ClipMat(mat gocv.Mat, minVal, maxVal float32)

ClipMat clips the values of a gocv.Mat within a specified range. mat need to be float32 type

func CreateStaticBoxMask

func CreateStaticBoxMask(cropSize Size, faceMaskBlur float64, faceMaskPadding Padding) gocv.Mat

CreateStaticBoxMask create a static box mask with specified size, blur, and padding.

func InvertAffineMatrix

func InvertAffineMatrix(affineMatrix gocv.Mat) gocv.Mat

func MatSubtract

func MatSubtract(mat gocv.Mat, v float64)

MatSubtract subtract value v fom mat

func PasteBack

func PasteBack(targetVisionFrame gocv.Mat, cropVisionFrame gocv.Mat, cropMask gocv.Mat, affineMatrix gocv.Mat) gocv.Mat

PasteBack paste cropVisionFrame back to targetVisionFrame

func ReduceMinimum

func ReduceMinimum(mats []gocv.Mat) gocv.Mat

ReduceMinimum finds the element-wise minimum of a list of gocv.Mat

func WarpFaceByFaceLandmark5

func WarpFaceByFaceLandmark5(visionFrame gocv.Mat, faceLandmark5 []gocv.Point2f, warpTemplate []gocv.Point2f, cropSize Size) (gocv.Mat, gocv.Mat)

func WarpFaceByTranslation

func WarpFaceByTranslation(visionFrame gocv.Mat, translation Translation, scale float64, cropSize image.Point) (gocv.Mat, gocv.Mat)

Types

type BoundingBox

type BoundingBox struct {
	X1, Y1, X2, Y2 float64
}

type Model

type Model[I any, O any] interface {
	ModelMeta
	PreProcess(input I) ([]*protobuf.InferTensorContents, error)
	PostProcess(rawOutputContents [][]byte) (O, error)
}

type ModelMeta

type ModelMeta interface {
	ModelName() string
	ModelVersion() string
}

type Padding

type Padding struct {
	Top, Right, Bottom, Left float64
}

Padding represents the padding values for the mask.

type Size

type Size struct {
	Width, Height int
}

Size represents the width and height dimensions.

type Translation

type Translation [2]float64

Translation represents the translation vector.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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