mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[Bug Fix] add ocr new feature and fix codestyle (#764)
* fix ocr bug and add new feature * fix bug * fix bug * fix bug * fix bug * fix bug * fix bug * add property * add test * fix code style * fix bug * fix bug * fix bug * fix port * fix ocr * fix_ocr * fix ocr * fix ocr * fix ocr * fix ocr * Update paddle2onnx.cmake * Update paddle2onnx.cmake * Update paddle2onnx.cmake Co-authored-by: Jason <jiangjiajun@baidu.com> Co-authored-by: Jason <928090362@qq.com>
This commit is contained in:
2
fastdeploy/vision/ocr/ppocr/utils/ocr_utils.h
Normal file → Executable file
2
fastdeploy/vision/ocr/ppocr/utils/ocr_utils.h
Normal file → Executable file
@@ -33,6 +33,8 @@ FASTDEPLOY_DECL cv::Mat GetRotateCropImage(const cv::Mat& srcimage,
|
||||
|
||||
FASTDEPLOY_DECL void SortBoxes(std::vector<std::array<int, 8>>* boxes);
|
||||
|
||||
FASTDEPLOY_DECL std::vector<int> ArgSort(const std::vector<float> &array);
|
||||
|
||||
} // namespace ocr
|
||||
} // namespace vision
|
||||
} // namespace fastdeploy
|
||||
|
||||
13
fastdeploy/vision/ocr/ppocr/utils/sorted_boxes.cc
Normal file → Executable file
13
fastdeploy/vision/ocr/ppocr/utils/sorted_boxes.cc
Normal file → Executable file
@@ -44,6 +44,19 @@ void SortBoxes(std::vector<std::array<int, 8>>* boxes) {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<int> ArgSort(const std::vector<float> &array) {
|
||||
const int array_len(array.size());
|
||||
std::vector<int> array_index(array_len, 0);
|
||||
for (int i = 0; i < array_len; ++i)
|
||||
array_index[i] = i;
|
||||
|
||||
std::sort(
|
||||
array_index.begin(), array_index.end(),
|
||||
[&array](int pos1, int pos2) { return (array[pos1] < array[pos2]); });
|
||||
|
||||
return array_index;
|
||||
}
|
||||
|
||||
} // namespace ocr
|
||||
} // namespace vision
|
||||
} // namespace fastdeploy
|
||||
|
||||
Reference in New Issue
Block a user