-
Notifications
You must be signed in to change notification settings - Fork 1
/
p2pnet.go
45 lines (37 loc) · 868 Bytes
/
p2pnet.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
package counter
/*
#include <stdlib.h>
#include <stdbool.h>
#include "openvision/counter/counter.h"
*/
import "C"
import (
"unsafe"
"github.com/bububa/openvision/go/common"
)
// P2PNet represents p2pnet counter
type P2PNet struct {
d C.ICounter
}
// NewP2PNet returns a new P2PNet
func NewP2PNet() *P2PNet {
return &P2PNet{
d: C.new_p2pnet_crowd_counter(),
}
}
// Destroy free tracker
func (d *P2PNet) Destroy() {
common.DestroyEstimator(d)
}
// Pointer implement Estimator interface
func (d *P2PNet) Pointer() unsafe.Pointer {
return unsafe.Pointer(d.d)
}
// LoadModel load model for detecter
func (d *P2PNet) LoadModel(modelPath string) error {
return common.EstimatorLoadModel(d, modelPath)
}
// CrowdCount implement Object Counter interface
func (d *P2PNet) CrowdCount(img *common.Image) ([]common.Keypoint, error) {
return CrowdCount(d, img)
}