Skip to content

Commit

Permalink
fix cpp infer (PaddlePaddle#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
littletomatodonkey authored Jan 7, 2021
1 parent a27bd4d commit 9336e34
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion deploy/cpp_infer/include/ocr_cls.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Classifier {
const int &gpu_id, const int &gpu_mem,
const int &cpu_math_library_num_threads,
const bool &use_mkldnn, const double &cls_thresh,
const bool &use_tensorrt, const &bool use_fp16) {
const bool &use_tensorrt, const bool &use_fp16) {
this->use_gpu_ = use_gpu;
this->gpu_id_ = gpu_id;
this->gpu_mem_ = gpu_mem;
Expand Down
5 changes: 2 additions & 3 deletions deploy/cpp_infer/include/ocr_det.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ class DBDetector {
const bool &use_mkldnn, const int &max_side_len,
const double &det_db_thresh,
const double &det_db_box_thresh,
const double &det_db_unclip_ratio,
const bool &visualize const bool &use_tensorrt,
const bool &use_fp16) {
const double &det_db_unclip_ratio, const bool &visualize,
const bool &use_tensorrt, const bool &use_fp16) {
this->use_gpu_ = use_gpu;
this->gpu_id_ = gpu_id;
this->gpu_mem_ = gpu_mem;
Expand Down
4 changes: 2 additions & 2 deletions deploy/cpp_infer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ int main(int argc, char **argv) {
auto end = std::chrono::system_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::microseconds>(end - start);
std::cout << "花费了"
std::cout << "Cost"
<< double(duration.count()) *
std::chrono::microseconds::period::num /
std::chrono::microseconds::period::den
<< "" << std::endl;
<< "s" << std::endl;

return 0;
}
2 changes: 1 addition & 1 deletion deploy/cpp_infer/src/ocr_cls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void Classifier::LoadModel(const std::string &model_dir) {
if (this->use_mkldnn_) {
config.EnableMKLDNN();
}
config.SetCpuMathLibraryNumThreads(this->cpu_math_library_num_threads_)
config.SetCpuMathLibraryNumThreads(this->cpu_math_library_num_threads_);
}

// false for zero copy tensor
Expand Down
4 changes: 2 additions & 2 deletions deploy/cpp_infer/src/ocr_rec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
float(*std::max_element(&predict_batch[n * predict_shape[2]],
&predict_batch[(n + 1) * predict_shape[2]]));

if (argmax_idx > 0 && (not(i > 0 && argmax_idx == last_index))) {
if (argmax_idx > 0 && (!(i > 0 && argmax_idx == last_index))) {
score += max_value;
count += 1;
str_res.push_back(label_list_[argmax_idx]);
Expand Down Expand Up @@ -183,4 +183,4 @@ cv::Mat CRNNRecognizer::GetRotateCropImage(const cv::Mat &srcimage,
}
}

} // namespace PaddleOCR
} // namespace PaddleOCR

0 comments on commit 9336e34

Please sign in to comment.