Golang Liveness PAD Example¶
Initialize LivenessPAD module
import ("oneml/face")
livenessPad := new LivenessPAD()
Initialize LivenessPAD module with licensing
import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
livenessPad := face.NewLivenessPAD(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
image := oneMLUtils.ReadImageCV(filePath)
Run the model
// run both image blur check and face pad check
ops := face.NewLivenessPADOps(true)
result := livenessPad.Run(image, ops)
And get the output
livenessScore := result.GetLivenessScore)
liveness := result.GetLiveness()
status := result.GetReturnStatus()
Cleanup
defer face.DeleteLivenessPAD(livenessPad)
defer face.DeleteUtils(oneMLUtils)