File tree 1 file changed +9
-2
lines changed
fastdeploy/vision/ocr/ppocr
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,9 @@ void BindPPOCRModel(pybind11::module& m) {
119
119
auto mat = PyArrayToCvMat (data);
120
120
std::vector<std::array<int , 8 >> boxes_result;
121
121
self.Predict (mat, &boxes_result);
122
- return boxes_result;
122
+ vision::OCRResult ocr_result;
123
+ ocr_result.boxes = boxes_result;
124
+ return ocr_result;
123
125
})
124
126
.def (" batch_predict" , [](vision::ocr::DBDetector& self,
125
127
std::vector<pybind11::array>& data) {
@@ -129,7 +131,12 @@ void BindPPOCRModel(pybind11::module& m) {
129
131
images.push_back (PyArrayToCvMat (data[i]));
130
132
}
131
133
self.BatchPredict (images, &det_results);
132
- return det_results;
134
+ std::vector<vision::OCRResult> ocr_results;
135
+ ocr_results.resize (det_results.size ());
136
+ for (int i = 0 ; i < det_results.size (); i++) {
137
+ ocr_results[i].boxes = det_results[i];
138
+ }
139
+ return ocr_results;
133
140
});
134
141
135
142
// Classifier
You can’t perform that action at this time.
0 commit comments