From a1cee85a239316bcbf76f220b2c3575fc67c4b90 Mon Sep 17 00:00:00 2001 From: jiangjiajun Date: Wed, 5 Aug 2020 09:36:10 +0000 Subject: [PATCH] fix bug of classification resize by short --- deploy/cpp/src/transforms.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/cpp/src/transforms.cpp b/deploy/cpp/src/transforms.cpp index 626b205..f623fc6 100644 --- a/deploy/cpp/src/transforms.cpp +++ b/deploy/cpp/src/transforms.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "include/paddlex/transforms.h" @@ -60,8 +61,8 @@ bool ResizeByShort::Run(cv::Mat* im, ImageBlob* data) { data->reshape_order_.push_back("resize"); float scale = GenerateScale(*im); - int width = static_cast(scale * im->cols); - int height = static_cast(scale * im->rows); + int width = static_cast(round(scale * im->cols)); + int height = static_cast(round(scale * im->rows)); cv::resize(*im, *im, cv::Size(width, height), 0, 0, cv::INTER_LINEAR); data->new_im_size_[0] = im->rows; -- GitLab