lite deploy is throwing an exception "vector too long" in RunRecModel when using ch_PP-OCRv4_rec_infer #13017
Replies: 1 comment
-
The problem is this code in PaddleOCR/deploy/lite/ocr_db_crnn.cc Line 586 in 0525f6b int width = srcimg.cols;
int height = srcimg.rows;
std::vector<int> upper_left = {0, 0};
std::vector<int> upper_right = {width, 0};
std::vector<int> lower_right = {width, height};
std::vector<int> lower_left = {0, height};
std::vector<std::vector<int>> box = {upper_left, upper_right, lower_right, lower_left};
std::vector<std::vector<std::vector<int>>> boxes = {box}; When passing lite_demo.png to process text, it's getting scaled down to a very small size by this call PaddleOCR/deploy/lite/ocr_db_crnn.cc Line 187 in 0525f6b I'm not sure about this behavior of passing an image as a single box containing multiple text blocks. I replaced the code by actually calculating the boxes first using auto detpredictor = loadModel("data/ch_PP-OCRv4_det_infer", 2);
std::vector<double> times;
auto boxes = RunDetModel(detpredictor, srcimg, Config, ×); This correctly calculates all the 63 text boxes that exist in the image.
When 2nd iteration of the loop executes PaddleOCR/deploy/lite/ocr_db_crnn.cc Line 178 in 0525f6b control never reaches beyond this line and terminates the program PaddleOCR/deploy/lite/ocr_db_crnn.cc Line 192 in 0525f6b I tried resetting the predictor at the end of the loop using predictor_crnn.reset(); but to no avail. It seems the predictor is only working for one time. Any pointers? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Environment:
Windows 10
Visual Studio 17 2022
OpenCV 4.9.0 custom build
inference_lite_lib.win.x86.MSVC.C++_static.py37.full_publish.zip (downloaded)
The det is running fine with ch_PP-OCRv4_det_infer model.
The RunRecModel is either throwing an exception "vector too long" or terminating silently when using ch_PP-OCRv4_rec_infer.
The dictionary is ppocr_keys_v1.txt, test image is lite_demp.png and config.txt contents:
I tried both the configurations MobileConfig and CxxConfig. det is working fine in both the cases but rec is throwing the same exception "vector too long"
Beta Was this translation helpful? Give feedback.
All reactions