Face Alignment(人脸对齐)#

fastdeploy.vision.facealign.PFLD#

class fastdeploy.vision.facealign.PFLD(model_file, params_file='', runtime_option=None, model_format=<ModelFormat.ONNX: 2>)[source]#

Load a face alignment model exported by PFLD.

Parameters
  • model_file – (str)Path of model file, e.g pfld/pfld-106-v3.onnx

  • params_file – (str)Path of parameters file, if the model_fomat is ModelFormat.ONNX, this param will be ignored, can be set as empty string

  • runtime_option – (fastdeploy.RuntimeOption)RuntimeOption for inference this model, if it’s None, will use the default backend on CPU

  • model_format – (fastdeploy.ModelForamt)Model format of the loaded model, default is ONNX

get_profile_time()#

Get profile time of Runtime after the profile process is done.

predict(input_image)[source]#

Detect an input image landmarks

Parameters

im – (numpy.ndarray)The input image data, 3-D array with layout HWC, BGR format

Returns

FaceAlignmentResult

property size#

Returns the preprocess image size, default (112, 112)

fastdeploy.vision.facealign.FaceLandmark1000#

class fastdeploy.vision.facealign.FaceLandmark1000(model_file, params_file='', runtime_option=None, model_format=<ModelFormat.ONNX: 2>)[source]#

Load a face alignment model exported by FaceLandmark1000.

Parameters
  • model_file – (str)Path of model file, e.g ./FaceLandmark1000.onnx

  • params_file – (str)Path of parameters file, if the model_fomat is ModelFormat.ONNX, this param will be ignored, can be set as empty string

  • runtime_option – (fastdeploy.RuntimeOption)RuntimeOption for inference this model, if it’s None, will use the default backend on CPU

  • model_format – (fastdeploy.ModelForamt)Model format of the loaded model, default is ONNX

get_profile_time()#

Get profile time of Runtime after the profile process is done.

predict(input_image)[source]#

Detect an input image landmarks

Parameters

im – (numpy.ndarray)The input image data, 3-D array with layout HWC, BGR format

Returns

FaceAlignmentResult

property size#

Returns the preprocess image size, default (128, 128)

fastdeploy.vision.facealign.PIPNet#

class fastdeploy.vision.facealign.PIPNet(model_file, params_file='', runtime_option=None, model_format=<ModelFormat.ONNX: 2>)[source]#

Load a face alignment model exported by PIPNet.

Parameters
  • model_file – (str)Path of model file, e.g ./PIPNet.onnx

  • params_file – (str)Path of parameters file, if the model_fomat is ModelFormat.ONNX, this param will be ignored, can be set as empty string

  • runtime_option – (fastdeploy.RuntimeOption)RuntimeOption for inference this model, if it’s None, will use the default backend on CPU

  • model_format – (fastdeploy.ModelForamt)Model format of the loaded model, default is ONNX

get_profile_time()#

Get profile time of Runtime after the profile process is done.

property mean_vals#

Returns the mean value of normlization, default mean_vals = [0.485f, 0.456f, 0.406f];

property num_landmarks#

Returns the number of landmarks

predict(input_image)[source]#

Detect an input image landmarks

Parameters

im – (numpy.ndarray)The input image data, 3-D array with layout HWC, BGR format

Returns

FaceAlignmentResult

property size#

Returns the preprocess image size, default (256, 256)

property std_vals#

Returns the std value of normlization, default std_vals = [0.229f, 0.224f, 0.225f];