Golang Face Detector Example

Initialize face detector model

import ("oneml/face")
detector := new FaceDetector()

Initialize face detector model with licensing

import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
detector := face.NewFaceDetector(licenseManager)

Initialize oneML’s Utils

Utils utils = face.NewUtils()

Initialize oneML’s Utils with licensing

Utils utils = face.NewUtils(licenseManager)

Read input as oneML’s Image

img := utils.ReadImageCV(filePath)

Run the model

results := detector.Detect(batch)

or

result := detector.Detect(img)

And get the output

scores := result.GetScores()
bboxes := result.GetBBoxes()
landmarks := result.GetLandmarks()
poses := result.GetPoses()
size := result.GetSize()
statuses := result.GetReturnStatus()

Cleanup

defer face.DeleteFaceDetector(detector)