From 716fa9442ec6a1cdaaf35d2eb6a6be0676ade79a Mon Sep 17 00:00:00 2001 From: luoyao Date: Thu, 2 Nov 2023 17:52:49 +0800 Subject: [PATCH] update --- src/models/classification/dinov2.inl | 5 ++--- src/models/classification/mobilenetv2.inl | 4 ++-- src/models/classification/resnet.inl | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/models/classification/dinov2.inl b/src/models/classification/dinov2.inl index 8f97a936..8a635268 100644 --- a/src/models/classification/dinov2.inl +++ b/src/models/classification/dinov2.inl @@ -171,7 +171,7 @@ public: private: std::string _m_model_file_path; // mnn interpreter - std::unique_ptr _m_net = nullptr; + MNN::Interpreter* _m_net = nullptr; // mnn session MNN::Session* _m_session = nullptr; // mnn session config @@ -226,8 +226,7 @@ StatusCode Dinov2::Impl::init(const decltype(toml::parse(""))& co return StatusCode::MODEL_INIT_FAILED; } - _m_net = std::unique_ptr(MNN::Interpreter::createFromFile(_m_model_file_path.c_str())); - + _m_net = MNN::Interpreter::createFromFile(_m_model_file_path.c_str()); if (_m_net == nullptr) { LOG(ERROR) << "Create Interpreter failed, model file path: " << _m_model_file_path; _m_successfully_initialized = false; diff --git a/src/models/classification/mobilenetv2.inl b/src/models/classification/mobilenetv2.inl index a6711fdc..6008a06b 100644 --- a/src/models/classification/mobilenetv2.inl +++ b/src/models/classification/mobilenetv2.inl @@ -171,7 +171,7 @@ public: private: std::string _m_model_file_path; // MNN Net - std::unique_ptr _m_net = nullptr; + MNN::Interpreter* _m_net = nullptr; // MNN Session MNN::Session* _m_session = nullptr; // MNN Session Config @@ -226,7 +226,7 @@ StatusCode MobileNetv2::Impl::init(const decltype(toml::parse("") return StatusCode::MODEL_INIT_FAILED; } - _m_net = std::unique_ptr(MNN::Interpreter::createFromFile(_m_model_file_path.c_str())); + _m_net = MNN::Interpreter::createFromFile(_m_model_file_path.c_str()); if (_m_net == nullptr) { LOG(ERROR) << "Create Interpreter failed, model file path: " << _m_model_file_path; _m_successfully_initialized = false; diff --git a/src/models/classification/resnet.inl b/src/models/classification/resnet.inl index d5a8a890..32014264 100644 --- a/src/models/classification/resnet.inl +++ b/src/models/classification/resnet.inl @@ -171,7 +171,7 @@ public: private: std::string _m_model_file_path; // MNN Net - std::unique_ptr _m_net = nullptr; + MNN::Interpreter* _m_net = nullptr; // MNN session MNN::Session* _m_session = nullptr; // MNN session @@ -226,8 +226,7 @@ StatusCode ResNet::Impl::init(const decltype(toml::parse(""))& co return StatusCode::MODEL_INIT_FAILED; } - _m_net = std::unique_ptr(MNN::Interpreter::createFromFile(_m_model_file_path.c_str())); - + _m_net = MNN::Interpreter::createFromFile(_m_model_file_path.c_str()); if (_m_net == nullptr) { LOG(ERROR) << "Create Interpreter failed, model file path: " << _m_model_file_path; _m_successfully_initialized = false;