[Other]Fastdeploy supports set_model_buffer function for encrypted model (#930)

* Update keypointdetection result docs

* Update im.copy() to im in examples

* Update new Api, fastdeploy::vision::Visualize to fastdeploy::vision

* Update SwapBackgroundSegmentation && SwapBackgroundMatting to SwapBackground

* Update README_CN.md

* Update README_CN.md

* Support set_model_buffer function
This commit is contained in:
huangjianhui
2022-12-21 14:21:28 +08:00
committed by GitHub
parent b42ec302e6
commit 291db315c8
6 changed files with 110 additions and 12 deletions

View File

@@ -88,6 +88,20 @@ struct FASTDEPLOY_DECL RuntimeOption {
const std::string& params_path = "",
const ModelFormat& format = ModelFormat::PADDLE);
/** \brief Specify the memory buffer of model and parameter. Used when model and params are loaded directly from memory
*
* \param[in] model_buffer The memory buffer of model
* \param[in] model_buffer_size The size of the model data
* \param[in] params_buffer The memory buffer of the combined parameters file
* \param[in] params_buffer_size The size of the combined parameters data
* \param[in] format Format of the loaded model
*/
void SetModelBuffer(const char * model_buffer,
size_t model_buffer_size,
const char * params_buffer,
size_t params_buffer_size,
const ModelFormat& format = ModelFormat::PADDLE);
/// Use cpu to inference, the runtime will inference on CPU by default
void UseCpu();
@@ -431,6 +445,12 @@ struct FASTDEPLOY_DECL RuntimeOption {
std::string params_file = ""; // Path of parameters file, can be empty
// format of input model
ModelFormat model_format = ModelFormat::AUTOREC;
std::string model_buffer_ = "";
std::string params_buffer_ = "";
size_t model_buffer_size_ = 0;
size_t params_buffer_size_ = 0;
bool model_from_memory_ = false;
};
/*! @brief Runtime object used to inference the loaded model on different devices