Golang Face Pad Example¶
Golang PadRGB Example¶
Initialize pad RGB model
import ("oneml/face")
padRgb := face.NewFacePad(PadType.Rgb)
Initialize face detector model with licensing
import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
padRgb := face.NewFacePad(PadType.Rgb, 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(filePath1)
Run the model
rgbResults := padRgb.Classify(batch1)
or
rgbResult := padRgb.Classify(img1)
And get the output
spoofProb := rgbResult.GetSpoofProb()
isSpoof := rgbResult.IsSpoof()
status := rgbResult.GetReturnStatus()
Cleanup
defer face.DeletefacePad(padRgb)
defer face.DeleteUtils(utils)
Golang PadPaper Example¶
Initialize pad paper model
import ("oneml/face")
padPaper := face.NewFacePad(PadType.Paper)
Initialize pad paper model with licensing
import ("oneml/face")
licenseManager := face.NewLicenseManager()
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE")
licenseManager.ActivateKey()
padPaper := face.NewFacePad(PadType.Paper, licenseManager)
Initialize oneML’s Utils
utils := face.NewUtils()
Initialize oneML’s Utils with licensing
utils := face.NewUtils(licenseManager)
Read input as oneML’s Image
img2 := utils.ReadImageCV(filePath2)
Run the model
paperResults := padPaper.Classify(batch2)
or
paperResult := padPaper.Classify(img2)
And get the output
spoofProb := paperResult.GetSpoofProb()
isSpoof := paperResult.IsSpoof()
status := paperResult.GetReturnStatus()
Cleanup
defer face.DeleteFacePad(padPaper)
defer face.DeleteUtils(utils)