[Model] change ocr pre and post (#568)

* change ocr pre and post

* add pybind

* change ocr

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix bug

* fix copy bug

* fix code style

* fix bug

* add new function

* fix windows ci bug
This commit is contained in:
Thomas Young
2022-11-18 13:17:42 +08:00
committed by GitHub
parent 1609ce1bab
commit 143506b654
31 changed files with 1402 additions and 569 deletions
+18
View File
@@ -31,6 +31,15 @@ void BindPPOCRv3(pybind11::module& m) {
vision::OCRResult res;
self.Predict(&mat, &res);
return res;
})
.def("batch_predict", [](pipeline::PPOCRv3& self, std::vector<pybind11::array>& data) {
std::vector<cv::Mat> images;
for (size_t i = 0; i < data.size(); ++i) {
images.push_back(PyArrayToCvMat(data[i]));
}
std::vector<vision::OCRResult> results;
self.BatchPredict(images, &results);
return results;
});
}
@@ -49,6 +58,15 @@ void BindPPOCRv2(pybind11::module& m) {
vision::OCRResult res;
self.Predict(&mat, &res);
return res;
})
.def("batch_predict", [](pipeline::PPOCRv2& self, std::vector<pybind11::array>& data) {
std::vector<cv::Mat> images;
for (size_t i = 0; i < data.size(); ++i) {
images.push_back(PyArrayToCvMat(data[i]));
}
std::vector<vision::OCRResult> results;
self.BatchPredict(images, &results);
return results;
});
}