`Segmentation fault` is detected by the operating system

Posted cv.exp

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了`Segmentation fault` is detected by the operating system相关的知识,希望对你有一定的参考价值。

最近碰到的问题,在解决

--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0   paddle::framework::SignalHandle(char const*, int)
1   paddle::platform::GetCurrentTraceBackString[abi:cxx11]()

----------------------
Error Message Summary:
----------------------
FatalError: `Segmentation fault` is detected by the operating system.
  [TimeInfo: *** Aborted at ******(unix time) try "date -d @******" if you are using GNU date ***]
  [SignalInfo: *** SIGSEGV (@0x0) received by PID ****** (TID 0x******) from PID 0 ***]

Segmentation fault (core dumped)
>>> import os
>>> import cv2
>>> from paddleocr import PPStructure,draw_structure_result,save_structure_res
>>> 
>>> table_engine = PPStructure(show_log=True)
download https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar to /home/user/.paddleocr/2.2.0.1/ocr/rec/ch/ch_ppocr_mobile_v2.0_rec_infer/ch_ppocr_mobile_v2.0_rec_infer.tar
100%|█████████████████████████████████████| 3.90M/3.90M [00:02<00:00, 1.80MiB/s]
download https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_structure_infer.tar to /home/user/.paddleocr/2.2.0.1/ocr/table/en_ppocr_mobile_v2.0_table_structure_infer/en_ppocr_mobile_v2.0_table_structure_infer.tar
100%|█████████████████████████████████████| 19.7M/19.7M [00:09<00:00, 2.10MiB/s]
Namespace(benchmark=False, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir=None, cls_thresh=0.9, cpu_threads=10, det=True, det_algorithm='DB', det_db_box_thresh=0.6, det_db_score_mode='fast', det_db_thresh=0.3, det_db_unclip_ratio=1.5, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_east_score_thresh=0.8, det_limit_side_len=960, det_limit_type='max', det_model_dir='/home/user/.paddleocr/2.2.0.1/ocr/det/ch/ch_ppocr_mobile_v2.0_det_infer', det_sast_nms_thresh=0.2, det_sast_polygon=False, det_sast_score_thresh=0.5, drop_score=0.5, e2e_algorithm='PGNet', e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_limit_side_len=768, e2e_limit_type='max', e2e_model_dir=None, e2e_pgnet_mode='fast', e2e_pgnet_polygon=True, e2e_pgnet_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, gpu_mem=500, help='==SUPPRESS==', image_dir=None, ir_optim=True, label_list=['0', '180'], lang='ch', layout_path_model='lp://PubLayNet/ppyolov2_r50vd_dcn_365e_publaynet/config', max_batch_size=10, max_text_length=25, min_subgraph_size=10, output='./output/table', precision='fp32', process_id=0, rec=True, rec_algorithm='CRNN', rec_batch_num=6, rec_char_dict_path='/home/user/cv/PaddleOCR/ppocr/utils/ppocr_keys_v1.txt', rec_char_type='ch', rec_image_shape='3, 32, 320', rec_model_dir='/home/user/.paddleocr/2.2.0.1/ocr/rec/ch/ch_ppocr_mobile_v2.0_rec_infer', save_log_path='./log_output/', show_log=True, table_char_dict_path='/home/user/cv/PaddleOCR/ppocr/utils/dict/table_structure_dict.txt', table_char_type='en', table_max_len=488, table_model_dir='/home/user/.paddleocr/2.2.0.1/ocr/table/en_ppocr_mobile_v2.0_table_structure_infer', total_process_num=1, type='ocr', use_angle_cls=False, use_dilation=False, use_gpu=True, use_mp=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=True)
E0821 05:24:01.021597  3169 analysis_config.cc:81] Please compile with gpu to EnableGpu()
--- Running analysis [ir_graph_build_pass]
--- Running analysis [ir_graph_clean_pass]
--- Running analysis [ir_analysis_pass]
--- Running IR pass [simplify_with_basic_ops_pass]
--- Running IR pass [layer_norm_fuse_pass]
---    Fused 0 subgraphs into layer_norm op.
--- Running IR pass [attention_lstm_fuse_pass]
--- Running IR pass [seqconv_eltadd_relu_fuse_pass]
--- Running IR pass [seqpool_cvm_concat_fuse_pass]
--- Running IR pass [mul_lstm_fuse_pass]
--- Running IR pass [fc_gru_fuse_pass]
--- Running IR pass [mul_gru_fuse_pass]
--- Running IR pass [seq_concat_fc_fuse_pass]
--- Running IR pass [squeeze2_matmul_fuse_pass]
--- Running IR pass [reshape2_matmul_fuse_pass]
--- Running IR pass [flatten2_matmul_fuse_pass]
--- Running IR pass [map_matmul_to_mul_pass]
--- Running IR pass [fc_fuse_pass]
--- Running IR pass [repeated_fc_relu_fuse_pass]
--- Running IR pass [squared_mat_sub_fuse_pass]
--- Running IR pass [conv_bn_fuse_pass]
I0821 05:24:02.281390  3169 graph_pattern_detector.cc:91] ---  detected 33 subgraphs
--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]
--- Running IR pass [conv_transpose_bn_fuse_pass]
--- Running IR pass [is_test_pass]
--- Running IR pass [runtime_context_cache_pass]
--- Running analysis [ir_params_sync_among_devices_pass]
--- Running analysis [adjust_cudnn_workspace_size_pass]
--- Running analysis [inference_op_replace_pass]
--- Running analysis [memory_optimize_pass]
I0821 05:24:02.380620  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_44.tmp_1  size: 1920
I0821 05:24:02.380724  3169 memory_optimize_pass.cc:199] Cluster name : elementwise_add_2  size: 614400
I0821 05:24:02.380743  3169 memory_optimize_pass.cc:199] Cluster name : nearest_interp_v2_5.tmp_0  size: 2457600
I0821 05:24:02.380753  3169 memory_optimize_pass.cc:199] Cluster name : conv2d_60.tmp_0  size: 13107200
I0821 05:24:02.380764  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_4.tmp_2  size: 13107200
I0821 05:24:02.380774  3169 memory_optimize_pass.cc:199] Cluster name : tmp_2  size: 9830400
I0821 05:24:02.380782  3169 memory_optimize_pass.cc:199] Cluster name : elementwise_add_5  size: 256000
I0821 05:24:02.380792  3169 memory_optimize_pass.cc:199] Cluster name : x  size: 4915200
I0821 05:24:02.380801  3169 memory_optimize_pass.cc:199] Cluster name : conv2d_59.tmp_0  size: 3276800
--- Running analysis [ir_graph_to_program_pass]
I0821 05:24:02.593567  3169 analysis_predictor.cc:636] ======= optimize end =======
I0821 05:24:02.602075  3169 naive_executor.cc:98] ---  skip [feed], feed -> x
I0821 05:24:02.611042  3169 naive_executor.cc:98] ---  skip [batch_norm_4.tmp_2], fetch -> fetch
E0821 05:24:02.658640  3169 analysis_config.cc:81] Please compile with gpu to EnableGpu()
--- Running analysis [ir_graph_build_pass]
--- Running analysis [ir_graph_clean_pass]
--- Running analysis [ir_analysis_pass]
--- Running IR pass [simplify_with_basic_ops_pass]
--- Running IR pass [layer_norm_fuse_pass]
---    Fused 0 subgraphs into layer_norm op.
--- Running IR pass [attention_lstm_fuse_pass]
--- Running IR pass [seqconv_eltadd_relu_fuse_pass]
--- Running IR pass [seqpool_cvm_concat_fuse_pass]
--- Running IR pass [mul_lstm_fuse_pass]
--- Running IR pass [fc_gru_fuse_pass]
--- Running IR pass [mul_gru_fuse_pass]
--- Running IR pass [seq_concat_fc_fuse_pass]
--- Running IR pass [squeeze2_matmul_fuse_pass]
--- Running IR pass [reshape2_matmul_fuse_pass]
--- Running IR pass [flatten2_matmul_fuse_pass]
--- Running IR pass [map_matmul_to_mul_pass]
I0821 05:24:03.173434  3169 graph_pattern_detector.cc:91] ---  detected 1 subgraphs
--- Running IR pass [fc_fuse_pass]
I0821 05:24:03.181550  3169 graph_pattern_detector.cc:91] ---  detected 1 subgraphs
--- Running IR pass [repeated_fc_relu_fuse_pass]
--- Running IR pass [squared_mat_sub_fuse_pass]
--- Running IR pass [conv_bn_fuse_pass]
I0821 05:24:03.263113  3169 graph_pattern_detector.cc:91] ---  detected 24 subgraphs
--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]
--- Running IR pass [conv_transpose_bn_fuse_pass]
--- Running IR pass [is_test_pass]
--- Running IR pass [runtime_context_cache_pass]
--- Running analysis [ir_params_sync_among_devices_pass]
--- Running analysis [adjust_cudnn_workspace_size_pass]
--- Running analysis [inference_op_replace_pass]
--- Running analysis [memory_optimize_pass]
I0821 05:24:03.341871  3169 memory_optimize_pass.cc:199] Cluster name : lstm_0._generated_var_0  size: 1
I0821 05:24:03.342039  3169 memory_optimize_pass.cc:199] Cluster name : fill_constant_batch_size_like_0.tmp_0  size: 768
I0821 05:24:03.342059  3169 memory_optimize_pass.cc:199] Cluster name : hard_sigmoid_7.tmp_0  size: 1152
I0821 05:24:03.342068  3169 memory_optimize_pass.cc:199] Cluster name : ctc_fc.tmp_1  size: 662500
I0821 05:24:03.342077  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_14.tmp_2  size: 96000
I0821 05:24:03.342087  3169 memory_optimize_pass.cc:199] Cluster name : x  size: 38400
I0821 05:24:03.342095  3169 memory_optimize_pass.cc:199] Cluster name : lstm_0.tmp_3  size: 1
I0821 05:24:03.342103  3169 memory_optimize_pass.cc:199] Cluster name : softmax_0.tmp_0  size: 662500
I0821 05:24:03.342113  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_6.tmp_2  size: 25600
--- Running analysis [ir_graph_to_program_pass]
I0821 05:24:03.534315  3169 analysis_predictor.cc:636] ======= optimize end =======
I0821 05:24:03.541127  3169 naive_executor.cc:98] ---  skip [feed], feed -> x
I0821 05:24:03.548465  3169 naive_executor.cc:98] ---  skip [ctc_fc.tmp_1], fetch -> fetch
E0821 05:24:03.557241  3169 analysis_config.cc:81] Please compile with gpu to EnableGpu()
--- Running analysis [ir_graph_build_pass]
--- Running analysis [ir_graph_clean_pass]
--- Running analysis [ir_analysis_pass]
--- Running IR pass [simplify_with_basic_ops_pass]
--- Running IR pass [layer_norm_fuse_pass]
---    Fused 0 subgraphs into layer_norm op.
--- Running IR pass [attention_lstm_fuse_pass]
--- Running IR pass [seqconv_eltadd_relu_fuse_pass]
--- Running IR pass [seqpool_cvm_concat_fuse_pass]
--- Running IR pass [mul_lstm_fuse_pass]
--- Running IR pass [fc_gru_fuse_pass]
--- Running IR pass [mul_gru_fuse_pass]
--- Running IR pass [seq_concat_fc_fuse_pass]
--- Running IR pass [squeeze2_matmul_fuse_pass]
--- Running IR pass [reshape2_matmul_fuse_pass]
--- Running IR pass [flatten2_matmul_fuse_pass]
--- Running IR pass [map_matmul_to_mul_pass]
I0821 05:24:04.572161  3169 graph_pattern_detector.cc:91] ---  detected 3 subgraphs
--- Running IR pass [repeated_fc_relu_fuse_pass]
--- Running IR pass [squared_mat_sub_fuse_pass]
--- Running IR pass [conv_bn_fuse_pass]
I0821 05:24:04.677933  3169 graph_pattern_detector.cc:91] ---  detected 32 subgraphs
--- Running IR pass [conv_eltwiseadd_bn_fuse_pass]
--- Running IR pass [conv_transpose_bn_fuse_pass]
--- Running IR pass [is_test_pass]
--- Running IR pass [runtime_context_cache_pass]
--- Running analysis [ir_params_sync_among_devices_pass]
--- Running analysis [adjust_cudnn_workspace_size_pass]
--- Running analysis [inference_op_replace_pass]
--- Running analysis [memory_optimize_pass]
I0821 05:24:04.767616  3169 memory_optimize_pass.cc:199] Cluster name : elementwise_add_4  size: 307520
I0821 05:24:04.767851  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_4.tmp_3  size: 15241216
I0821 05:24:04.767923  3169 memory_optimize_pass.cc:199] Cluster name : conv2d_66.tmp_0  size: 15241216
I0821 05:24:04.767951  3169 memory_optimize_pass.cc:199] Cluster name : x  size: 2857728
I0821 05:24:04.767964  3169 memory_optimize_pass.cc:199] Cluster name : relu_4.tmp_0  size: 4286592
I0821 05:24:04.767983  3169 memory_optimize_pass.cc:199] Cluster name : batch_norm_6.tmp_3  size: 1428864
--- Running analysis [ir_graph_to_program_pass]
I0821 05:24:05.018383  3169 analysis_predictor.cc:636] ======= optimize end =======
I0821 05:24:05.026230  3169 naive_executor.cc:98] ---  skip [feed], feed -> x
I0821 05:24:05.130802  3169 naive_executor.cc:98] ---  skip [conv2d_66.tmp_0], fetch -> fetch
I0821 05:24:05.130851  3169 naive_executor.cc:98] ---  skip [batch_norm_4.tmp_3], fetch -> fetch
download https://paddle-model-ecology.bj.bcebos.com/model/layout-parser/ppyolov2_r50vd_dcn_365e_publaynet.tar to /home/user/.paddledet/inference_model/ppyolov2_r50vd_dcn_365e_publaynet/ppyolov2_r50vd_dcn_365e_publaynet_infer/ppyolov2_r50vd_dcn_365e_publaynet.tar
100%|███████████████████████████████████████| 221M/221M [01:57<00:00, 1.88MiB/s]
E0821 05:26:07.691921  3169 analysis_config.cc:81] Please compile with gpu to EnableGpu()
---    Fused 0 subgraphs into layer_norm op.
>>> 
>>> save_folder = './output/table'
>>> img_path = './doc/table/1.png'
>>> img = cv2.imread(img_path)
>>> result = table_engine(img)
[2021/08/21 05:29:23] root DEBUG: dt_boxes num : 94, elapse : 0.38495922088623047
[2021/08/21 05:29:25] root DEBUG: rec_res num  : 94, elapse : 2.23537540435791
[2021/08/21 05:29:27] root DEBUG: dt_boxes num : 3, elapse : 0.9256072044372559
[2021/08/21 05:29:27] root DEBUG: rec_res num  : 3, elapse : 0.28577423095703125
[2021/08/21 05:29:35] root DEBUG: dt_boxes num : 71, elapse : 0.29612255096435547
[2021/08/21 05:29:36] root DEBUG: rec_res num  : 71, elapse : 1.4252643585205078
[2021/08/21 05:29:36] root DEBUG: dt_boxes num : 2, elapse : 0.024176836013793945
[2021/08/21 05:29:36] root DEBUG: rec_res num  : 2, elapse : 0.09573960304260254
[2021/08/21 05:29:36] root DEBUG: dt_boxes num : 2, elapse : 0.03563046455383301
[2021/08/21 05:29:37] root DEBUG: rec_res num  : 2, elapse : 0.12619781494140625
[2021/08/21 05:29:37] root DEBUG: dt_boxes num : 6, elapse : 0.13263654708862305
[2021/08/21 05:29:38] root DEBUG: rec_res num  : 6, elapse : 1.5138394832611084
[2021/08/21 05:29:38] root DEBUG: dt_boxes num : 1, elapse : 0.04615926742553711
[2021/08/21 05:29:38] root DEBUG: rec_res num  : 1, elapse : 0.02641916275024414
[2021/08/21 05:29:38] root DEBUG: dt_boxes num : 3, elapse : 0.058660030364990234
[2021/08/21 05:29:39] root DEBUG: rec_res num  : 3, elapse : 0.316359281539917
[2021/08/21 05:29:39] root DEBUG: dt_boxes num : 1, elapse : 0.013834238052368164
[2021/08/21 05:29:39] root DEBUG: rec_res num  : 1, elapse : 0.04638028144836426
>>>
>>> save_structure_res(result, save_folder,os.path.basename(img_path).split('.')[0])
>>> for line in result:
...   line.pop('img')
...   print(line)
... 
array([[[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       ...,

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[217, 217, 217],
        [120, 120, 120],
        [120, 120, 120],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]]], dtype=uint8)
'type': 'Table', 'bbox': [17, 361, 404, 711], 'res': '<html><body><table><thead><tr><td>Methods</td><td>Ext</td><td></td><td></td><td>F </td><td>FPS</td></tr></thead><tbody><tr><td>TextSnake[18]</td><td>syn</td><td>853</td><td>679</td><td>73.6</td><td></td></tr><tr><td>CSE [171</td><td>MLT</td><td>76.1</td><td>78.7</td><td>77.4</td><td>0.38</td></tr><tr><td>LOMO[40]</td><td>Syn</td><td>76.5</td><td>85.7</td><td>80.8</td><td>44</td></tr><tr><td>ATRR3SJ</td><td>Sy-</td><td>80.2</td><td>80.1</td><td>80.1</td><td></td></tr><tr><td>SegLink++[28]</td><td>Syn</td><td>79.8</td><td>82.8</td><td>81.3</td><td></td></tr><tr><td>TextField [37]</td><td>Syn</td><td>79.8</td><td>83.0</td><td>81.4</td><td>6.0</td></tr><tr><td>MSR38]</td><td>Syn</td><td>79.0</td><td>84.1</td><td>81.5</td><td>4.3</td></tr><tr><td>PSENet-ls [33]</td><td>MLT</td><td>79.7</td><td>84.8</td><td>82.2</td><td>3.9</td></tr><tr><td>DB [12]</td><td>Syn</td><td>80.2</td><td>86.9</td><td>83.4</td><td>22.0</td></tr><tr><td>CRAFT [2]</td><td>Syn</td><td>81.1</td><td>86.0</td><td>83.5</td><td></td></tr><tr><td>TextDragon [5J</td><td>MLT+</td><td>82.8</td><td>84.5</td><td>83.6</td><td></td></tr><tr><td>PAN [34]</td><td>Syn</td><td>81.2</td><td>86.4</td><td>83.7</td><td>39.8</td></tr><tr><td>ContourNet [36]</td><td></td><td>84.1</td><td>83.7</td><td>83.9</td><td>4.5</td></tr><tr><td>DRRG [41]</td><td>MLT</td><td></td><td>83.0285.9384.45</td><td></td><td></td></tr><tr><td>TextPerception23</td><td>Syn</td><td></td><td></td><td>81.987.584.6</td><td></td></tr><tr><td>Ours</td><td></td><td></td><td>80.5787.6683.9712.08</td><td></td><td></td></tr><tr><td>Ours</td><td>Syn</td><td></td><td>81.4587.8184.5112.15</td><td></td><td></td></tr><tr><td>Ours</td><td>MLT</td><td>83.60</td><td>86.45</td><td>85.00</td><td>012.21</td></tr></table></body></html>'
array([[[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       ...,

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 255],
        [255, 255, 255],
        [255, 255, 255],
        ...,
        [255, 255, 255],
        [255, 255, 255segmentation fault

Segmentation Fault 错误原因总结及解决方法

Segmentation Fault 错误原因总结及解决方法

C++ Segmentation fault 一般原因

C++ Segmentation fault 一般原因

LINUX 环境下 调用动态库 出现segmentation fault 异常 请高手解答!