-
Notifications
You must be signed in to change notification settings - Fork 1
/
yoloface.go
46 lines (38 loc) · 911 Bytes
/
yoloface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package detecter
/*
#include <stdlib.h>
#include <stdbool.h>
#include "openvision/face/detecter.h"
*/
import "C"
import (
"unsafe"
"github.com/bububa/openvision/go/common"
"github.com/bububa/openvision/go/face"
)
// YoloFace represents yoloface detecter
type YoloFace struct {
d C.IFaceDetecter
}
// NewYoloFace returns a new YoloFace
func NewYoloFace() *YoloFace {
return &YoloFace{
d: C.new_yoloface(),
}
}
// Destroy free detecter
func (d *YoloFace) Destroy() {
common.DestroyEstimator(d)
}
// Pointer implement Estimator interface
func (d *YoloFace) Pointer() unsafe.Pointer {
return unsafe.Pointer(d.d)
}
// LoadModel implement Detecter interface
func (d *YoloFace) LoadModel(modelPath string) error {
return common.EstimatorLoadModel(d, modelPath)
}
// Detect implement Detecter interface
func (d *YoloFace) Detect(img *common.Image) ([]face.FaceInfo, error) {
return Detect(d, img)
}