From 3c5bc166a563cd851f3e3b5e1a019f7fa0207ab0 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 18 四月 2024 23:22:01 +0800 Subject: [PATCH] fix cycle import --- compare/faceSdk.go | 17 +++-------------- 1 files changed, 3 insertions(+), 14 deletions(-) diff --git a/compare/faceSdk.go b/compare/faceSdk.go index 49fa258..8ed054d 100644 --- a/compare/faceSdk.go +++ b/compare/faceSdk.go @@ -1,7 +1,7 @@ package compare import ( - "unsafe" + "sdkCompare/util" ) // #if FEATURE_NORMALIZE @@ -84,8 +84,8 @@ } func DecCompare(feat1, feat2 []byte) float32 { - ffeat1 := ByteSlice2float32Slice(feat1) - ffeat2 := ByteSlice2float32Slice(feat2) + ffeat1 := util.ByteSlice2float32Slice(feat1) + ffeat2 := util.ByteSlice2float32Slice(feat2) if len(feat1) != len(feat2) { return 0 } @@ -105,15 +105,4 @@ } //fmt.Println("score:", score) return score -} - -func ByteSlice2float32Slice(src []byte) []float32 { - if len(src) == 0 { - return nil - } - - l := len(src) / 4 - ptr := unsafe.Pointer(&src[0]) - - return (*[1 << 26]float32)((*[1 << 26]float32)(ptr))[:l:l] } -- Gitblit v1.8.0