From f920096e7c74131448a05b565bf08193093b26a2 Mon Sep 17 00:00:00 2001 From: yunyaoXYY Date: Mon, 19 Dec 2022 10:15:53 +0000 Subject: [PATCH] fix conflict for ascend --- fastdeploy/fastdeploy_model.cc | 1 + fastdeploy/fastdeploy_model.h | 2 ++ fastdeploy/vision/ocr/ppocr/rec_preprocessor.cc | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fastdeploy/fastdeploy_model.cc b/fastdeploy/fastdeploy_model.cc index 185efde0a..164416835 100755 --- a/fastdeploy/fastdeploy_model.cc +++ b/fastdeploy/fastdeploy_model.cc @@ -73,6 +73,7 @@ bool FastDeployModel::InitRuntimeWithSpecifiedBackend() { if (!IsSupported(valid_cann_backends, runtime_option.backend)) { FDERROR << "The valid cann backends of model " << ModelName() << " are " << Str(valid_cann_backends) << ", " << runtime_option.backend << " is not supported." << std::endl; return false; + } } else if (use_xpu) { if (!IsSupported(valid_xpu_backends, runtime_option.backend)) { FDERROR << "The valid xpu backends of model " << ModelName() << " are " << Str(valid_xpu_backends) << ", " << runtime_option.backend << " is not supported." << std::endl; diff --git a/fastdeploy/fastdeploy_model.h b/fastdeploy/fastdeploy_model.h index 7e9bac16d..73bf5c9e1 100755 --- a/fastdeploy/fastdeploy_model.h +++ b/fastdeploy/fastdeploy_model.h @@ -151,7 +151,9 @@ class FASTDEPLOY_DECL FastDeployModel { bool CreateTimVXBackend(); bool CreateXPUBackend(); bool CreateCANNBackend(); + std::shared_ptr runtime_; + bool runtime_initialized_ = false; // whether to record inference time bool enable_record_time_of_runtime_ = false; diff --git a/fastdeploy/vision/ocr/ppocr/rec_preprocessor.cc b/fastdeploy/vision/ocr/ppocr/rec_preprocessor.cc index 4d5fab4c0..f54ca808c 100644 --- a/fastdeploy/vision/ocr/ppocr/rec_preprocessor.cc +++ b/fastdeploy/vision/ocr/ppocr/rec_preprocessor.cc @@ -44,11 +44,11 @@ void OcrRecognizerResizeImage(FDMat* mat, float max_wh_ratio, void OcrRecognizerResizeImageOnAscend(FDMat* mat, const std::vector& rec_image_shape) { - + + int img_h, img_w; img_h = rec_image_shape[1]; img_w = rec_image_shape[2]; - if (mat->Width() >= img_w) { Resize::Run(mat, img_w, img_h); // Reszie W to 320 } else {