Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaddleLite deploy lite core dump #2962

Closed
idreamerhx opened this issue May 28, 2021 · 4 comments
Closed

PaddleLite deploy lite core dump #2962

idreamerhx opened this issue May 28, 2021 · 4 comments

Comments

@idreamerhx
Copy link

idreamerhx commented May 28, 2021

@WenmuZhou

thnaks

version 2.9

./ocr_db_crnn models/ch_ppocr_mobile_v2.0_det_opt.nb models/ch_ppocr_mobile_v2.0_cls_opt.nb models/ch_ppocr_mobile_v2.0_rec_opt.nb data/imgs/11.jpg data/ppocr_keys_v1.txt

[W 5/28 17:18:11. 55 ...e-Lite/lite/model_parser/model_parser.cc:882 LoadModelFbsFromFile] warning: the version of opt that transformed this model is not consistent with current Paddle-Lite version. version of opt:6010b5f version of current Paddle-Lite:1e59d1fb [W 5/28 17:18:11. 63 ...e-Lite/lite/model_parser/model_parser.cc:882 LoadModelFbsFromFile] warning: the version of opt that transformed this model is not consistent with current Paddle-Lite version. version of opt:6010b5f version of current Paddle-Lite:1e59d1fb [W 5/28 17:18:11. 70 ...e-Lite/lite/model_parser/model_parser.cc:882 LoadModelFbsFromFile] warning: the version of opt that transformed this model is not consistent with current Paddle-Lite version. version of opt:6010b5f version of current Paddle-Lite:1e59d1fb [I 5/28 17:18:11.113 ...ddle-Lite/lite/kernels/arm/conv_direct.h:207 PrepareForRun] param.filter: [I 5/28 17:18:11.401 ...ddle-Lite/lite/kernels/arm/conv_direct.h:207 PrepareForRun] param.filter: [I 5/28 17:18:11.445 ...ddle-Lite/lite/kernels/arm/conv_direct.h:207 PrepareForRun] param.filter: Segmentation fault (core dumped)

Core was generated by./ocr_db_crnn models/ch_ppocr_mobile_v2.0_det_opt.nb models/ch_ppocr_mobile_v2.'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000558c546d54 in __gnu_cxx::__ops::_Iter_less_iter::operator()<float const*, float const*> (this=0x7fe34e3018, __it1=0x55bfe91bf4, __it2=0x55c0697000)
at /usr/include/c++/7/bits/predefined_ops.h:43
43 { return __it1 < __it2; }
[Current thread is 1 (Thread 0x7f72609010 (LWP 7527))]
(gdb) bt
#0 0x000000558c546d54 in __gnu_cxx::__ops::_Iter_less_iter::operator()<float const
, float const
> (this=0x7fe34e3018, __it1=0x55bfe91bf4, __it2=0x55c0697000)
at /usr/include/c++/7/bits/predefined_ops.h:43
#1 0x000000558c546dd8 in std::__max_element<float const*, __gnu_cxx::__ops::_Iter_less_iter> (__first=0x55c0697000, __last=0x1acc0eeb580, __comp=...)
at /usr/include/c++/7/bits/stl_algo.h:5653
#2 0x000000558c545178 in std::max_element<float const*> (__first=0x55bfd02e40, __last=0x1acc0eeb580) at /usr/include/c++/7/bits/stl_algo.h:5678
#3 0x000000558c5451c0 in Argmax<float const*> (first=0x55bfd02e40, last=0x1acc0eeb580) at crnn_process.h:37
#4 0x000000558c540f3c in RunRecModel (boxes=std::vector of length 15, capacity 15 = {...}, img=...,
predictor_crnn=std::shared_ptrpaddle::lite_api::PaddlePredictor (use count 2, weak count 0) = {...}, rec_text=std::vector of length 2, capacity 2 = {...},
rec_text_score=std::vector of length 2, capacity 2 = {...}, charactor_dict=std::vector of length 6625, capacity 6625 = {...},
predictor_cls=std::shared_ptrpaddle::lite_api::PaddlePredictor (use count 2, weak count 0) = {...}, use_direction_classify=1) at ocr_db_crnn.cc:209
#5 0x000000558c542a6c in main (argc=6, argv=0x7fe34e3828) at ocr_db_crnn.cc:390
(gdb) f 4
#4 0x000000558c540f3c in RunRecModel (boxes=std::vector of length 15, capacity 15 = {...}, img=...,
predictor_crnn=std::shared_ptrpaddle::lite_api::PaddlePredictor (use count 2, weak count 0) = {...}, rec_text=std::vector of length 2, capacity 2 = {...},
rec_text_score=std::vector of length 2, capacity 2 = {...}, charactor_dict=std::vector of length 6625, capacity 6625 = {...},
predictor_cls=std::shared_ptrpaddle::lite_api::PaddlePredictor (use count 2, weak count 0) = {...}, use_direction_classify=1) at ocr_db_crnn.cc:209
warning: Source file is more recent than executable.
209 argmax_idx = int(Argmax(&predict_batch[n * predict_shape[2]],
(gdb) l
204 float score = 0.f;
205 int count = 0;
206 float max_value = 0.0f;
207
208 for (int n = 0; n < predict_shape[1]; n++) {
209 argmax_idx = int(Argmax(&predict_batch[n * predict_shape[2]],
210 &predict_batch[(n + 1) * predict_shape[2]]));
211 max_value =
212 float(*std::max_element(&predict_batch[n * predict_shape[2]],
213 &predict_batch[(n + 1) * predict_shape[2]]));
(gdb) p predict_shape
$1 = std::vector of length 2, capacity 2 = {1, 2}
`

@idreamerhx
Copy link
Author

If modify ocr_db_crnn.cc to:

for (int n = 0; n < predict_shape[0]; n++) {
  argmax_idx = int(Argmax(&predict_batch[n * predict_shape[1]],
                          &predict_batch[(n + 1) * predict_shape[1]]));
  max_value =
      float(*std::max_element(&predict_batch[n * predict_shape[1]],
                              &predict_batch[(n + 1) * predict_shape[1]]));
  if (argmax_idx > 0 && (!(n > 0 && argmax_idx == last_index))) {
    score += max_value;
    count += 1;
    str_res += charactor_dict[argmax_idx];
  }
  last_index = argmax_idx;
}

The detection visualized image saved in ./vis.jpg
0 ' 0.517064
1 nan
2 nan
3 nan
4 nan
5 ' 0.526346
6 nan
7 nan
8 ' 0.520074
9 ' 0.50233
10 nan
11 ' 0.609438
12 ' 0.506
13 nan
14 nan
花费了1.26909秒

@idreamerhx
Copy link
Author

x86 not work

export PADDLE_LITE_DIR=/opt/inference_lite_lib/cxx
export CXXFLAGS="-fopenmp -I$PADDLE_LITE_DIR/include -I./ -g -O0"

g++ $CXXFLAGS -c ocr_db_crnn.cc -o ocr_db_crnn.o
g++ $CXXFLAGS -c crnn_process.cc -o crnn_process.o
g++ $CXXFLAGS -c cls_process.cc -o cls_process.o
g++ $CXXFLAGS -c db_post_process.cc -o db_post_process.o
g++ $CXXFLAGS -c clipper.cpp -o clipper.o

g++ ocr_db_crnn.o crnn_process.o db_post_process.o clipper.o cls_process.o
-lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs
-L$PADDLE_LITE_DIR/lib -lpaddle_light_api_shared -o ocr_db_crnn

export LD_LIBRARY_PATH=$PADDLE_LITE_DIR/lib:$LD_LIBRARY_PATH
./ocr_db_crnn models/ch_ppocr_mobile_v2.0_det_opt.nb models/ch_ppocr_mobile_v2.0_cls_opt.nb models/ch_ppocr_mobile_v2.0_rec_opt.nb data/imgs/11.jpg data/ppocr_keys_v1.txt

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6a8a942 in paddle::lite::RuntimeProgram::RuntimeProgram(std::shared_ptr<paddle::lite::general::ProgramDesc const> const&, paddle::lite::Scope*, int) ()
from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
(gdb) bt
#0 0x00007ffff6a8a942 in paddle::lite::RuntimeProgram::RuntimeProgram(std::shared_ptr<paddle::lite::general::ProgramDesc const> const&, paddle::lite::Scope*, int) ()
from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
#1 0x00007ffff6a85092 in paddle::lite::LightPredictor::BuildRuntimeProgram(std::shared_ptr<paddle::lite::general::ProgramDesc const> const&) ()
from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
#2 0x00007ffff6a85760 in paddle::lite::LightPredictor::Build(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, bool) ()
from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
#3 0x00007ffff6a8824e in paddle::lite::LightPredictorImpl::Init(paddle::lite_api::MobileConfig const&) ()
from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
#4 0x00007ffff6a8892c in std::shared_ptrpaddle::lite_api::PaddlePredictor paddle::lite_api::CreatePaddlePredictorpaddle::lite_api::MobileConfig(paddle::lite_api::MobileConfig const&) () from /opt/inference_lite_lib/cxx/lib/libpaddle_light_api_shared.so
#5 0x000055555555dc8b in loadModel (model_file="models/ch_ppocr_mobile_v2.0_det_opt.nb") at ocr_db_crnn.cc:307
#6 0x000055555555e83f in main (argc=6, argv=0x7fffffffe4a8) at ocr_db_crnn.cc:384

@WenmuZhou
Copy link
Collaborator

use cmd like this

./ocr_db_crnn models/ch_ppocr_mobile_v2.0_det_opt.nb models/ch_ppocr_mobile_v2.0_rec_opt.nb models/ch_ppocr_mobile_v2.0_cls_opt.nb data/imgs/11.jpg data/ppocr_keys_v1.txt

@idreamerhx
Copy link
Author

thanks. it works!

According to the command usage:
./ocr_db_crnn
[ERROR] usage: ./ocr_db_crnn det_model_file cls_model_file rec_model_file image_path charactor_dict

please modify this hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants