Skip to content

Commit

Permalink
Merge pull request #8091 from WenmuZhou/cpp_infer2
Browse files Browse the repository at this point in the history
fix cls diff with python
  • Loading branch information
Evezerest authored Oct 25, 2022
2 parents c305acb + 2c1747b commit b324153
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions deploy/cpp_infer/src/ocr_cls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ void Classifier::Run(std::vector<cv::Mat> img_list,

this->normalize_op_.Run(&resize_img, this->mean_, this->scale_,
this->is_scale_);
if (resize_img.cols < cls_image_shape[2]) {
cv::copyMakeBorder(resize_img, resize_img, 0, 0, 0,
cls_image_shape[2] - resize_img.cols,
cv::BORDER_CONSTANT, cv::Scalar(0, 0, 0));
}
norm_img_batch.push_back(resize_img);
}
std::vector<float> input(batch_num * cls_image_shape[0] *
Expand Down
4 changes: 0 additions & 4 deletions deploy/cpp_infer/src/preprocess_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@ void ClsResizeImg::Run(const cv::Mat &img, cv::Mat &resize_img,

cv::resize(img, resize_img, cv::Size(resize_w, imgH), 0.f, 0.f,
cv::INTER_LINEAR);
if (resize_w < imgW) {
cv::copyMakeBorder(resize_img, resize_img, 0, 0, 0, imgW - resize_w,
cv::BORDER_CONSTANT, cv::Scalar(0, 0, 0));
}
}

void TableResizeImg::Run(const cv::Mat &img, cv::Mat &resize_img,
Expand Down

0 comments on commit b324153

Please sign in to comment.