-
Notifications
You must be signed in to change notification settings - Fork 1
/
retinaface.go
46 lines (38 loc) · 937 Bytes
/
retinaface.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"
)
// RetinaFace represents retinaface detecter
type RetinaFace struct {
d C.IFaceDetecter
}
// NewRetinaFace returns a new RetinaFace
func NewRetinaFace() *RetinaFace {
return &RetinaFace{
d: C.new_retinaface(),
}
}
// Destroy free detecter
func (d *RetinaFace) Destroy() {
common.DestroyEstimator(d)
}
// Pointer implement Estimator interface
func (d *RetinaFace) Pointer() unsafe.Pointer {
return unsafe.Pointer(d.d)
}
// LoadModel implement Detecter interface
func (d *RetinaFace) LoadModel(modelPath string) error {
return common.EstimatorLoadModel(d, modelPath)
}
// Detect implement Detecter interface
func (d *RetinaFace) Detect(img *common.Image) ([]face.FaceInfo, error) {
return Detect(d, img)
}