diff --git a/deploy/cpp_infer/include/ocr_cls.h b/deploy/cpp_infer/include/ocr_cls.h index 5dbfbf5a4a541c9542e4abac17d04c94a7a34444..38a37cff3c035eafe3617d83b2cc15ca47f30186 100644 --- a/deploy/cpp_infer/include/ocr_cls.h +++ b/deploy/cpp_infer/include/ocr_cls.h @@ -45,6 +45,7 @@ public: this->cpu_math_library_num_threads_ = cpu_math_library_num_threads; this->use_mkldnn_ = use_mkldnn; this->use_zero_copy_run_ = use_zero_copy_run; + this->cls_thresh = cls_thresh; LoadModel(model_dir); @@ -63,7 +64,7 @@ private: int gpu_mem_ = 4000; int cpu_math_library_num_threads_ = 4; bool use_mkldnn_ = false; - + bool use_zero_copy_run_ = false; double cls_thresh = 0.5; std::vector mean_ = {0.5f, 0.5f, 0.5f}; diff --git a/deploy/cpp_infer/src/ocr_cls.cpp b/deploy/cpp_infer/src/ocr_cls.cpp index 23a1c79c0eb15fdf52266f9fd7aff0889c992da1..7cdaaab40108026edffe5cb1ca53ac3972768cc6 100644 --- a/deploy/cpp_infer/src/ocr_cls.cpp +++ b/deploy/cpp_infer/src/ocr_cls.cpp @@ -96,7 +96,7 @@ void Classifier::LoadModel(const std::string &model_dir) { } // false for zero copy tensor - config.SwitchUseFeedFetchOps(false); + config.SwitchUseFeedFetchOps(!this->use_zero_copy_run_); // true for multiple input config.SwitchSpecifyInputNames(true); diff --git a/deploy/cpp_infer/tools/config.txt b/deploy/cpp_infer/tools/config.txt index 40beea3a2e6f0260a42202d6411ffb10907bf871..c59e5d55daa3b289210c67ac1d6ae08470218b9e 100644 --- a/deploy/cpp_infer/tools/config.txt +++ b/deploy/cpp_infer/tools/config.txt @@ -13,6 +13,10 @@ det_db_box_thresh 0.5 det_db_unclip_ratio 2.0 det_model_dir ./inference/det_db +# cls config +cls_model_dir ./inference/cls +cls_thresh 0.9 + # rec config rec_model_dir ./inference/rec_crnn char_list_file ../../ppocr/utils/ppocr_keys_v1.txt