From 6e6ae26a3d5a60967e52603cf10ed2299f7077c0 Mon Sep 17 00:00:00 2001 From: MissPenguin Date: Fri, 24 Sep 2021 11:11:03 +0000 Subject: [PATCH] fix rec cpp infer with trt --- deploy/cpp_infer/src/ocr_rec.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/deploy/cpp_infer/src/ocr_rec.cpp b/deploy/cpp_infer/src/ocr_rec.cpp index b64dcea5..3739a66a 100644 --- a/deploy/cpp_infer/src/ocr_rec.cpp +++ b/deploy/cpp_infer/src/ocr_rec.cpp @@ -112,12 +112,16 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) { 1 << 20, 10, 3, precision, false, false); + std::map> min_input_shape = { - {"x", {1, 3, 32, 10}}}; + {"x", {1, 3, 32, 10}}, + {"lstm_0.tmp_0", {10, 1, 96}}}; std::map> max_input_shape = { - {"x", {1, 3, 32, 2000}}}; + {"x", {1, 3, 32, 2000}}, + {"lstm_0.tmp_0", {1000, 1, 96}}}; std::map> opt_input_shape = { - {"x", {1, 3, 32, 320}}}; + {"x", {1, 3, 32, 320}}, + {"lstm_0.tmp_0", {25, 1, 96}}}; config.SetTRTDynamicShapeInfo(min_input_shape, max_input_shape, opt_input_shape); @@ -139,7 +143,7 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) { config.SwitchIrOptim(true); config.EnableMemoryOptim(); - config.DisableGlogInfo(); +// config.DisableGlogInfo(); this->predictor_ = CreatePredictor(config); } -- GitLab