Golang Face Landmark Example

Initialize face landmark model

import ("oneml/face")
landmarkDetector := face.NewFaceLandmarkDetector()

Initialize face landmark model with licensing

import ("oneml/face")
licenseManager := face.NewLicenseManager()
license_manager.SetKey("LICENSE_KEY_VALUE_HERE")
license_manager.ActivateKey()
landmarkDetector := face.NewFaceLandmarkDetector(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

// landmarks is Landmark5List, we can get landmarks from FaceDetectorResult
results := landmarkDetector.Detect(batch, landmarks, true)

or

// landmark is Landmark5, we can get landmark from FaceDetectorResult
result := detector.Detect(img, landmark, true)

And get the output

landmarks := result.GetLandmarks()
status := result.GetReturnStatus()

Cleanup

defer face.DeleteFaceLandmarkDetector(landmarkDetector)
defer face.DeleteUtils(utils)