| | |
| | | // RatioInterTrack 跟踪判断重叠阈值 |
| | | const RatioInterTrack = 50 //跟踪判断重叠阈值 |
| | | |
| | | // NewYolo init yolo sdk |
| | | func NewYolo(fc, fw, fn string, gi int) *YoloHandle { |
| | | // NewSDKYolo init yolo sdk |
| | | func NewSDKYolo(fc, fw, fn string, gi int) interface{} { |
| | | |
| | | c := C.CString(fc) |
| | | defer C.free(unsafe.Pointer(c)) |
| | |
| | | } |
| | | |
| | | // Free free |
| | | func Free(y *YoloHandle) { |
| | | func Free(i interface{}) { |
| | | y := i.(*YoloHandle) |
| | | if y != nil { |
| | | if y.handle != nil { |
| | | C.release(y.handle) |
| | |
| | | } |
| | | |
| | | // YoloObjName obj name by type |
| | | func YoloObjName(y *YoloHandle, typ int) string { |
| | | func YoloObjName(i interface{}, typ int) string { |
| | | y := i.(*YoloHandle) |
| | | p := C.obj_name_by_type(y.handle, C.int(typ)) |
| | | |
| | | return C.GoString(p) |
| | |
| | | } |
| | | |
| | | // Run yolo detect (只识别人) |
| | | func Run(y *YoloHandle, id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) { |
| | | func Run(i interface{}, id string, data []byte, w, h, c int, thrsh float32, umns int) ([]byte, []byte) { |
| | | if data == nil || w <= 0 || h <= 0 { |
| | | return nil, nil |
| | | } |
| | | y := i.(*YoloHandle) |
| | | |
| | | channel := c |
| | | if channel == 0 { |
| | | channel = 3 |