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

Base model object for all the vision models. More...

#include <fastdeploy_model.h>

Inheritance diagram for fastdeploy::FastDeployModel:
Inheritance graph
[legend]
Collaboration diagram for fastdeploy::FastDeployModel:
Collaboration graph
[legend]

Public Member Functions

virtual std::string ModelName () const
 Get model's name.
 
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< 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

Base model object for all the vision models.

Member Function Documentation

◆ EnableRecordTimeOfRuntime()

virtual void fastdeploy::FastDeployModel::EnableRecordTimeOfRuntime ( )
inlinevirtual

This is a debug interface, used to record the time of runtime (backend + h2d + d2h)

example code

auto model = fastdeploy::vision::PPYOLOE("model.pdmodel", "model.pdiparams", "infer_cfg.yml");
if (!model.Initialized()) {
std::cerr << "Failed to initialize." << std::endl;
return -1;
}
model.EnableRecordTimeOfRuntime();
cv::Mat im = cv::imread("test.jpg");
for (auto i = 0; i < 1000; ++i) {
model.Predict(&im, &result);
}
model.PrintStatisInfoOfRuntime();

After called the PrintStatisInfoOfRuntime(), the statistical information of runtime will be printed in the console

Member Data Documentation

◆ valid_ascend_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_ascend_backends = {}

Model's valid ascend backends. This member defined all the cann backends have successfully tested for the model

◆ valid_directml_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_directml_backends = {}

Model's valid directml backends. This member defined all the onnxruntime directml backends have successfully tested for the model

◆ valid_gpu_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_gpu_backends = {Backend::ORT}

Model's valid gpu backends. This member defined all the gpu backends have successfully tested for the model

◆ valid_ipu_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_ipu_backends = {}

Model's valid ipu backends. This member defined all the ipu backends have successfully tested for the model

◆ valid_kunlunxin_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_kunlunxin_backends = {}

Model's valid KunlunXin xpu backends. This member defined all the KunlunXin xpu backends have successfully tested for the model

◆ valid_rknpu_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_rknpu_backends = {}

Model's valid hardware backends. This member defined all the gpu backends have successfully tested for the model

◆ valid_sophgonpu_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_sophgonpu_backends = {}

Model's valid hardware backends. This member defined all the sophgo npu backends have successfully tested for the model

◆ valid_timvx_backends

std::vector<Backend> fastdeploy::FastDeployModel::valid_timvx_backends = {}

Model's valid timvx backends. This member defined all the timvx backends have successfully tested for the model


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