arcface

package
v0.0.0-...-076d552 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package to provide face-detection and features-retrieving

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLiveness

func CheckLiveness(src image.Image, input []float32, threshold float32) (bool, float32, error)

func ComputeSimilarity

func ComputeSimilarity(features1, features2 []float32) (float32, error)

/ Compute similarity between two face features(512 dim)

func CropFaceWithScale

func CropFaceWithScale(src image.Image, box []float32, scale float32) image.Image

修正后的scale倍外扩裁剪算法

func DetectFace

func DetectFace(src image.Image) ([][]float32, [][]float32, error)

Detect face in src image, return face boxes and landmarks, ordered by predict scores.

func LoadOnnxModel

func LoadOnnxModel(onnxmodel_path string, modeEnv string) (err error)

func SetLogger

func SetLogger(l *log.Logger)

Types

type AbstractFaceFeaturesOption

type AbstractFaceFeaturesOption func(*AbstractFaceFeaturesOptions)

func AbstractFaceFeaturesWithGenderAge

func AbstractFaceFeaturesWithGenderAge() AbstractFaceFeaturesOption

func AbstractFaceFeaturesWithLimit

func AbstractFaceFeaturesWithLimit(maxFaceNum int) AbstractFaceFeaturesOption

func AbstractFaceFeaturesWithLiveness

func AbstractFaceFeaturesWithLiveness(threshold float32) AbstractFaceFeaturesOption

type AbstractFaceFeaturesOptions

type AbstractFaceFeaturesOptions struct {
	WithGenderAge     bool
	LivenessThreshold float32
	MaxFaceNum        int
}

type FaceData

type FaceData struct {
	// 0 female, 1 male
	Gender    uint8
	Age       uint32
	Features  []float32
	IsLive    bool    // 是否为活体
	LiveScore float32 // 活体置信度得分
	FaceImage image.Image
	// 人脸框坐标x1,y1,x2,y2
	FaceBox []float32
	// 是否为人脸的置信度
	Confidence float32
}

func AbstractFaceFeatures

func AbstractFaceFeatures(imgPath string, options ...AbstractFaceFeaturesOption) ([]*FaceData, error)

func AbstractFaceFeaturesFromData

func AbstractFaceFeaturesFromData(imgData []byte, options ...AbstractFaceFeaturesOption) ([]*FaceData, error)

func AbstractFaceFeaturesFromImage

func AbstractFaceFeaturesFromImage(img image.Image, options ...AbstractFaceFeaturesOption) ([]*FaceData, error)

func FaceFeatures

func FaceFeatures(src image.Image, lmks [][]float32, options ...AbstractFaceFeaturesOption) (faces []*FaceData, err error)

Get face features by Arcface Parameter src is original image, lmks is face landmark detected by FaceDetect(), return features in a arrary, and norm_crop image

Jump to

Keyboard shortcuts

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