mtcnn

package module
v0.0.0-...-cd8d13c Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 8 Imported by: 0

README

go-mtcnn

go-mtcnn is a go package for face detection in images. It uses https://github.com/ipazc/mtcnn as a reference implementation. It is based on the Zhang, K et al. (2016)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPnetWeights, DefaultRnetWeights, DefaultOnetWeights [][]float32

Functions

func ReadWeightsFromBin

func ReadWeightsFromBin(r io.Reader) (weights [][]float32, err error)

Types

type Conv2D

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

func NewConv2D

func NewConv2D(kerWidth, kerHeight, channels, outputs int, weights []float32, biases []float32) *Conv2D

func (*Conv2D) Apply

func (c *Conv2D) Apply(input Data2D) (result Data2D)

type Data2D

type Data2D struct {
	Width, Height int
	Channels      int
	Values        []float32
}

func ImageToData2D

func ImageToData2D(img image.Image) Data2D

func ImageToData2DTanspose

func ImageToData2DTanspose(img image.Image) Data2D

func NewData2D

func NewData2D(width, height, channels int) Data2D

func ReadData2DFromBin

func ReadData2DFromBin(r io.Reader) ([]Data2D, error)

func (Data2D) GetIndex

func (d Data2D) GetIndex(x, y, channel int) int

func (Data2D) TotalSize

func (d Data2D) TotalSize() int

type Dense

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

func NewDense

func NewDense(inputSize, outputSize int, weights, bias []float32) *Dense

func (*Dense) Apply

func (d *Dense) Apply(input Data2D) (result Data2D)

type Detector

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

func NewDetector

func NewDetector(pnetWeights, rnetWeights, onetWeights [][]float32, options *DetectorOptions) *Detector

func (*Detector) DetectFaces

func (d *Detector) DetectFaces(img image.Image) []FaceData

type DetectorOptions

type DetectorOptions struct {
	MinFaceSize     int
	StageThresholds [3]float32
	ScaleFactor     float32
}

type FaceData

type FaceData struct {
	Box        image.Rectangle
	Confidence float32

	LeftEye, RightEye, Nose, MouthLeft, MouthRight image.Point
}

func DetectFaces

func DetectFaces(img image.Image) []FaceData

type Flatten

type Flatten struct{}

func (*Flatten) Apply

func (f *Flatten) Apply(input Data2D) (result Data2D)

type Layer2D

type Layer2D interface {
	Apply(Data2D) Data2D
}

type LayerData

type LayerData struct {
	Layer2D
	InputIndex int
}

type MaxPooling2D

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

func NewMaxPooling2D

func NewMaxPooling2D(poolWidth, poolHeight, strideX, strideY int) *MaxPooling2D

func (*MaxPooling2D) Apply

func (mp *MaxPooling2D) Apply(input Data2D) (result Data2D)

type Model

type Model struct {
	Layers  []LayerData
	Outputs []int
}

func (*Model) Compute

func (m *Model) Compute(input Data2D) []Data2D

type PReLU

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

func NewPReLU

func NewPReLU(parameters []float32, axis int) *PReLU

func (*PReLU) Apply

func (pl *PReLU) Apply(input Data2D) (result Data2D)

type Softmax

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

func NewSoftmax

func NewSoftmax(axis int) *Softmax

func (*Softmax) Apply

func (s *Softmax) Apply(input Data2D) (result Data2D)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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