瀏覽代碼

Merge pull request #2 from PaddlePaddle/develop

update
mamingjie-China 5 年之前
父節點
當前提交
534eda3e3d
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      deploy/cpp/src/transforms.cpp

+ 3 - 2
deploy/cpp/src/transforms.cpp

@@ -15,6 +15,7 @@
 #include <iostream>
 #include <string>
 #include <vector>
+#include <math.h>
 
 #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<int>(scale * im->cols);
-  int height = static_cast<int>(scale * im->rows);
+  int width = static_cast<int>(round(scale * im->cols));
+  int height = static_cast<int>(round(scale * im->rows));
   cv::resize(*im, *im, cv::Size(width, height), 0, 0, cv::INTER_LINEAR);
 
   data->new_im_size_[0] = im->rows;