From c4219c2715ce41482401f8b519f6b4232a8bfaf3 Mon Sep 17 00:00:00 2001 From: channings Date: Thu, 16 Jul 2020 14:00:28 +0800 Subject: [PATCH] fix bug of image_shape of Resize is not define in yml (#1064) --- deploy/cpp/include/preprocess_op.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deploy/cpp/include/preprocess_op.h b/deploy/cpp/include/preprocess_op.h index bb2d0ca3e..af672ea81 100644 --- a/deploy/cpp/include/preprocess_op.h +++ b/deploy/cpp/include/preprocess_op.h @@ -91,9 +91,11 @@ class Resize : public PreprocessOp { arch_ = arch; interp_ = item["interp"].as(); max_size_ = item["max_size"].as(); - target_size_ = item["target_size"].as(); + if (item["image_shape"].IsDefined()) { image_shape_ = item["image_shape"].as>(); - } + } + target_size_ = item["target_size"].as(); + } // Compute best resize scale for x-dimension, y-dimension std::pair GenerateScale(const cv::Mat& im); @@ -156,3 +158,4 @@ class Preprocessor { }; } // namespace PaddleDetection + -- GitLab