Python Face Pad Example¶
Python PadRGB Example¶
Initialize pad RGB model
from oneML import faceAPI as api
pad = api.FacePad(API.PadType_Rgb)
Initialize pad RGB model with licensing
from oneML import faceAPI as api
license_manager = api.LicenseManager()
license_manager.set_key("LICENSE_KEY_VALUE_HERE")
license_manager.activate_key()
pad = api.FacePad(api.PadType_Rgb, license_manager)
Read input as numpy array
img = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)
imgs = np.expand_dims(img, axis=0)
Run the model
results = pad.classify(imgs)
or
result = pad.classify(img)
And get the output
spoof_prob = result.get_spoof_prob()
is_spoof = result.is_spoof()
status = result.get_return_status()
Python PadPaper Example¶
Initialize pad paper model
from oneML import faceAPI as api
pad = api.FacePad(api.PadType_Paper)
Initialize pad paper model with licensing
from oneML import faceAPI as api
license_manager = api.LicenseManager()
license_manager.set_key("LICENSE_KEY_VALUE_HERE")
license_manager.activate_key()
pad = api.FacePad(api.PadType_Paper, license_manager)
Read input as numpy array
img = np.array(cv2.cvtColor(cv2.imread(image_path), cv2.COLOR_BGR2RGB), dtype=np.uint8)
imgs = np.expand_dims(img, axis=0)
Run the model
results = pad.classify(imgs)
or
result = pad.classify(img)
And get the output
spoof_prob = result.get_spoof_prob()
is_spoof = result.is_spoof()
status = result.get_return_status()