Golang Face Id Example¶
Initialize faceID model
import ("oneml/face")
embedder := face.NewFaceEmbedder()
faceId := face.NewFaceId(embedder)
Initialize faceID model with licensing
import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
embedder := face.NewFaceEmbedder(licenseManager)
faceId := face.NewFaceId(embedder, licenseManager)
Initialize oneML’s Utils
utils := face.NewUtils()
Initialize oneML’s Utils with licensing
utils := face.NewUtils(licenseManager)
Read input as oneML’s Image
img1 := utils.ReadImageCV(path1)
img2 := utils.ReadImageCV(path2)
Run the model for verification
same1 := faceId.IsTheSamePerson(img1, img2)
Run the model for identification
result := faceId.Predict(img)
And get the output
status := result.GetReturnStatus()
isIdentifiable := result.IsIdentifiable()
id := result.GetId()
nearestDistance := result.GetNearestNodeDistance()
combinedDistance := result.GetCombinedDistance()
Cleanup
defer face.DeleteFaceEmbedder(embedder)
defer face.DeleteFaceId(faceId)
defer face.DeleteUtils(utils)