FastDeploy  latest
Fast & Easy to Deploy!
Public Member Functions | Public Attributes | List of all members
fastdeploy::vision::facedet::SCRFD Class Reference

SCRFD model object used when to load a SCRFD model exported by SCRFD. More...

#include <scrfd.h>

Inheritance diagram for fastdeploy::vision::facedet::SCRFD:
Inheritance graph
[legend]
Collaboration diagram for fastdeploy::vision::facedet::SCRFD:
Collaboration graph
[legend]

Public Member Functions

 SCRFD (const std::string &model_file, const std::string &params_file="", const RuntimeOption &custom_option=RuntimeOption(), const ModelFormat &model_format=ModelFormat::ONNX)
 Set path of model file and the configuration of runtime. More...
 
std::string ModelName () const
 Get model's name.
 
virtual bool Predict (cv::Mat *im, FaceDetectionResult *result, float conf_threshold=0.25f, float nms_iou_threshold=0.4f)
 Predict the face detection result for an input image. More...
 
void DisableNormalize ()
 This function will disable normalize and hwc2chw in preprocessing step.
 
void DisablePermute ()
 This function will disable hwc2chw in preprocessing step.
 
- Public Member Functions inherited from fastdeploy::FastDeployModel
virtual bool Infer (std::vector< FDTensor > &input_tensors, std::vector< FDTensor > *output_tensors)
 Inference the model by the runtime. This interface is included in the Predict() function, so we don't call Infer() directly in most common situation.
 
virtual bool Infer ()
 Inference the model by the runtime. This interface is using class member reused_input_tensors_ to do inference and writing results to reused_output_tensors_.
 
virtual int NumInputsOfRuntime ()
 Get number of inputs for this model.
 
virtual int NumOutputsOfRuntime ()
 Get number of outputs for this model.
 
virtual TensorInfo InputInfoOfRuntime (int index)
 Get input information for this model.
 
virtual TensorInfo OutputInfoOfRuntime (int index)
 Get output information for this model.
 
virtual bool Initialized () const
 Check if the model is initialized successfully.
 
virtual void EnableRecordTimeOfRuntime ()
 This is a debug interface, used to record the time of runtime (backend + h2d + d2h) More...
 
virtual void DisableRecordTimeOfRuntime ()
 Disable to record the time of runtime, see EnableRecordTimeOfRuntime() for more detail.
 
virtual std::map< std::string, float > PrintStatisInfoOfRuntime ()
 Print the statistic information of runtime in the console, see function EnableRecordTimeOfRuntime() for more detail.
 
virtual bool EnabledRecordTimeOfRuntime ()
 Check if the EnableRecordTimeOfRuntime() method is enabled.
 
virtual double GetProfileTime ()
 Get profile time of Runtime after the profile process is done.
 
virtual void ReleaseReusedBuffer ()
 Release reused input/output buffers.
 

Public Attributes

std::vector< int > size
 Argument for image preprocessing step, tuple of (width, height), decide the target size after resize, default (640, 640)
 
std::vector< int > downsample_strides
 Argument for image postprocessing step, downsample strides (namely, steps) for SCRFD to generate anchors, will take (8,16,32) as default values.
 
int landmarks_per_face
 Argument for image postprocessing step, landmarks_per_face, default 5 in SCRFD.
 
bool use_kps
 Argument for image postprocessing step, the outputs of onnx file with key points features or not, default true.
 
int max_nms
 Argument for image postprocessing step, the upperbond number of boxes processed by nms, default 30000.
 
unsigned int num_anchors
 Argument for image postprocessing step, anchor number of each stride, default 2.
 
- Public Attributes inherited from fastdeploy::FastDeployModel
std::vector< Backendvalid_cpu_backends = {Backend::ORT}
 Model's valid cpu backends. This member defined all the cpu backends have successfully tested for the model.
 
std::vector< Backendvalid_gpu_backends = {Backend::ORT}
 
std::vector< Backendvalid_ipu_backends = {}
 
std::vector< Backendvalid_timvx_backends = {}
 
std::vector< Backendvalid_directml_backends = {}
 
std::vector< Backendvalid_ascend_backends = {}
 
std::vector< Backendvalid_kunlunxin_backends = {}
 
std::vector< Backendvalid_rknpu_backends = {}
 
std::vector< Backendvalid_sophgonpu_backends = {}
 

Detailed Description

SCRFD model object used when to load a SCRFD model exported by SCRFD.

Constructor & Destructor Documentation

◆ SCRFD()

fastdeploy::vision::facedet::SCRFD::SCRFD ( const std::string &  model_file,
const std::string &  params_file = "",
const RuntimeOption custom_option = RuntimeOption(),
const ModelFormat model_format = ModelFormat::ONNX 
)

Set path of model file and the configuration of runtime.

Parameters
[in]model_filePath of model file, e.g ./scrfd.onnx
[in]params_filePath of parameter file, e.g ppyoloe/model.pdiparams, if the model format is ONNX, this parameter will be ignored
[in]custom_optionRuntimeOption for inference, the default will use cpu, and choose the backend defined in "valid_cpu_backends"
[in]model_formatModel format of the loaded model, default is ONNX format

Member Function Documentation

◆ Predict()

bool fastdeploy::vision::facedet::SCRFD::Predict ( cv::Mat *  im,
FaceDetectionResult result,
float  conf_threshold = 0.25f,
float  nms_iou_threshold = 0.4f 
)
virtual

Predict the face detection result for an input image.

Parameters
[in]imThe input image data, comes from cv::imread(), is a 3-D array with layout HWC, BGR format
[in]resultThe output face detection result will be writen to this structure
[in]conf_thresholdconfidence threashold for postprocessing, default is 0.25
[in]nms_iou_thresholdiou threashold for NMS, default is 0.4
Returns
true if the prediction successed, otherwise false

The documentation for this class was generated from the following files: