internal

package
v0.0.0-...-1cc333a Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FaceQualityClassBad = iota
	FaceQualityClassGood
	FaceQualityClassWearingMask
	FaceQualityClassWearingSunglasses
)
View Source
const (
	AgeEstimatorClassRange0_2 = iota
	AgeEstimatorClassRange3_9
	AgeEstimatorClassRange10_19
	AgeEstimatorClassRange20_29
	AgeEstimatorClassRange30_39
	AgeEstimatorClassRange40_49
	AgeEstimatorClassRange50_59
	AgeEstimatorClassRange60_69
	AgeEstimatorClassRange70_100
)

Variables

View Source
var FaceQualityClassMapper = map[int]string{
	FaceQualityClassBad:               "Bad",
	FaceQualityClassGood:              "Good",
	FaceQualityClassWearingMask:       "WearingMask",
	FaceQualityClassWearingSunglasses: "WearingSunGlasses",
}

Functions

func ConvertImageToOpenCV

func ConvertImageToOpenCV(bImage []byte) (*opencv.Mat, error)

ConvertImageToOpenCV converts the raw image into OpenCV Matrix

func GenerateAnchorsFPN2

func GenerateAnchorsFPN2(denseAnchor bool, cfgs map[string]Anchor) ([][][]float64, error)

GenerateAnchorsFPN2 generates anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window.

func OpenCVImageToJPEG

func OpenCVImageToJPEG(fPath string, jpegQuality int, opencvImg opencv.Mat) error

Types

type ARCFaceRecognitionConfig

type ARCFaceRecognitionConfig struct {
	// ModelName defines the name of the model to use
	ModelName string
	// Timeout defines duration in seconds
	Timeout   int64
	ImageSize [2]int32
	BatchSize int32
}

func DefaultARCFaceRecognitionConfig

func DefaultARCFaceRecognitionConfig() *ARCFaceRecognitionConfig

type AgeEstimatorConfig

type AgeEstimatorConfig struct {
	// ModelName defines the name of the model to use
	ModelName string
	// Timeout defines duration in seconds
	Timeout   int64
	ImageSize [2]int32
	BatchSize int32
}

func DefaultAgeEstimatorConfig

func DefaultAgeEstimatorConfig() *AgeEstimatorConfig

type Anchor

type Anchor struct {
	Scale         []float64
	BaseSize      int
	Ratio         []float64
	AllowedBorder int
}

type FaceAlignConfig

type FaceAlignConfig struct {
	ImageSize         [2]int
	StandardLandmarks VectorF32
}

func DefaultFaceAlignConfig

func DefaultFaceAlignConfig() *FaceAlignConfig

type FaceQualityConfig

type FaceQualityConfig struct {
	// ModelName defines the name of the model to use
	ModelName string
	// Timeout defines duration in seconds
	Timeout   int64
	ImageSize [2]int32
	BatchSize int32
	Threshold float32
}

func DefaultFaceQualityConfig

func DefaultFaceQualityConfig() *FaceQualityConfig

type FaceSelectionConfig

type FaceSelectionConfig struct {
	MarginCenterLeftRatio   float32
	MarginCenterRightRatio  float32
	MarginEdgeRatio         float32
	MinimumFaceRatio        float32
	MinimumWidthHeightRatio float32
	MaximumWidthHeightRatio float32
}

func DefaultFaceSelectionConfig

func DefaultFaceSelectionConfig() *FaceSelectionConfig

type ModelConfig

type ModelConfig struct {
}

type Pair

type Pair[T any] struct {
	A, B T
}

type RetinaFaceDetection

type RetinaFaceDetection struct {
	Config *RetinaFaceDetectionConfig
}

func NewRetinaFaceDetection

func NewRetinaFaceDetection() (*RetinaFaceDetection, error)

func (*RetinaFaceDetection) Forward

func (rfd *RetinaFaceDetection) Forward(src *opencv.Mat) ([]byte, error)

func (*RetinaFaceDetection) PreprocessOpenCVImg

func (rfd *RetinaFaceDetection) PreprocessOpenCVImg(src *opencv.Mat) (*opencv.Mat, float64, error)

type RetinaFaceDetectionConfig

type RetinaFaceDetectionConfig struct {
	// ModelName defines the name of the model to use
	ModelName string
	// Timeout defines duration in seconds
	Timeout             int64
	ImageSize           [2]int
	MaxBatchSize        int32
	ConfidenceThreshold float32
	IOUThreshold        float32
}

func DefaultRetinaFaceDetectionConfig

func DefaultRetinaFaceDetectionConfig() *RetinaFaceDetectionConfig

type VectorF32

type VectorF32 [][]float32

Jump to

Keyboard shortcuts

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