Golang Face Embedder Example¶
Initialize face embedder model
import ("oneml/face")
embedder := face.NewFaceEmbedder()
Initialize face embedder model with licensing
import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
embedder := face.NewFaceEmbedder(licenseManager)
Initialize oneML’s Utils
utils := face.NewUtils()
Initialize oneML’s Utils with licensing
utils := face.NewUtils(licenseManager)
Read input as oneML’s Image
img := utils.ReadImageCV(filePath)
Run the model
results := embedder.Embed(batch)
or
result := embedder.Embed(img)
To enable flipped image embedding, run
result := embedder.Embed(img, true)
And get the output
emb := result.GetEmbedding()
status := result.GetReturnStatus()
Cleanup
defer face.DeleteFaceEmbedder(embedder)
defer face.DeleteUtils(utils)