PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.05k stars 5.54k forks source link

在mac M3机器,python3.9,安装paddleocr,识别图片时候卡死无返回,不能正确执行 #66544

Open snow77 opened 1 month ago

snow77 commented 1 month ago

bug描述 Describe the Bug

python版本:3.9 paddleocr版本:2.7.3(试了最新的2.8.1也不行)

执行代码: import cv2 from paddleocr import PaddleOCR

picturePath = '1.png' chOcr = PaddleOCR(use_angle_cls=True, lang='ch', use_gpu=False) res = chOcr.ocr(picturePath)(在这里卡着不返回结果

测试在windows10,运行正常

其他补充信息 Additional Supplementary Information

python版本:3.9 paddleocr版本:2.7.3(试了最新的2.8.1也不行)

执行代码: import cv2 from paddleocr import PaddleOCR

picturePath = '1.png' chOcr = PaddleOCR(use_angle_cls=True, lang='ch', use_gpu=False) res = chOcr.ocr(picturePath)(在这里卡着不返回结果

测试在windows10,运行正常

vivienfanghuagood commented 1 month ago

你好,麻烦打开export FLAGS_call_stack_level=2 export GLOG_v=4 打开日志后跑下,然后把运行时的信息贴一下呢

snow77 commented 1 month ago

WARNING: Logging before InitGoogleLogging() is written to STDERR I0725 17:11:14.774951 4163205824 common.cc:284] Call SPMDRuleMap::Insert! WARNING: Logging before InitGoogleLogging() is written to STDERR I0725 17:11:14.822062 4163205824 dynamic_loader.cc:205] Set paddle lib path : /Users/liubingxing/Library/Python/3.9/lib/python/site-packages/paddle/libs WARNING: Logging before InitGoogleLogging() is written to STDERR I0725 17:11:14.831806 4163205824 ir_context.cc:194] BuiltinDialect registered into IrContext. ===> I0725 17:11:14.831938 4163205824 ir_context.cc:250] Try to get or register a Dialect of: [name=builtin]. I0725 17:11:14.831943 4163205824 ir_context.cc:253] Create and register a new Dialect of: [name=builtin]. I0725 17:11:14.832464 4163205824 ir_context.cc:196] ============================================== I0725 17:11:14.832497 4163205824 ir_context.cc:92] Found a cached abstract_attribute of: [TypeId_hash=12150963526186167854, AbstractAttribute_ptr=0x6000033ecb20]. I0725 17:11:14.832504 4163205824 builtin_op.cc:93] Verifying inputs, outputs and attributes for: ModuleOp. I0725 17:11:14.832510 4163205824 ir_context.cc:92] Found a cached abstract_attribute of: [TypeId_hash=12150963526186167854, AbstractAttribute_ptr=0x6000033ecb20]. I0725 17:11:14.832512 4163205824 builtin_op.cc:93] Verifying inputs, outputs and attributes for: ModuleOp. I0725 17:11:15.116171 4163205824 init.cc:97] Before Parse: argc is 2, Init commandline: dummy --tryfromenv=eager_delete_scope,use_autotune,pir_subgraph_saving_dir,fuse_parameter_memory_size,host_trace_level,free_idle_chunk,apply_pass_to_program,new_executor_sequential_run,set_to_1d,enable_all2all_use_fp16,initial_cpu_memory_in_mb,gpugraph_slot_feasign_max_num,use_stride_kernel,memory_fraction_of_eager_deletion,new_executor_use_local_scope,gpugraph_offload_param_extends,add_dependency_for_communication_op,gpugraph_hbm_table_load_factor,print_allocator_trace_info,sync_after_alloc,gpugraph_offload_param_stat,new_executor_use_cuda_graph,multiple_of_cupti_buffer_size,use_cuda_managed_memory,tracer_profile_fname,inner_op_parallelism,allocator_strategy,allreduce_record_one_event,alloc_fill_value,async_trace_count,einsum_opt,gpu_allocator_retry_time,print_sub_graph_dir,cpu_deterministic,enable_adjust_op_order,enable_auto_detect_gpu_topo,enable_async_trace,log_memory_stats,graph_embedding_split_infer_mode,enable_pir_api,enable_sparse_inner_gather,use_shm_cache,enable_tracker_all2all,convert_all_blocks,cache_inference_while_scope,enable_exit_when_partial_worker,use_mkldnn,dist_threadpool_size,new_executor_use_inplace,enable_unused_var_check,check_nan_inf,benchmark,tracer_mkldnn_ops_off,enable_pir_with_pt_in_dy2st,graph_load_in_parallel,gpugraph_enable_segment_merge_grads,gpugraph_load_node_list_into_hbm,gpugraph_enable_print_op_debug,enable_dependency_builder_debug_info,enable_record_memory,jit_engine_type,init_allocated_mem,use_stream_safe_cuda_allocator,free_when_no_cache_hit,use_auto_growth_pinned_allocator,tracer_mkldnn_ops_on,static_executor_perfstat_filepath,fuse_parameter_groups_size,prim_enabled,enable_pir_in_executor,query_dest_rank_by_multi_node,enable_graph_multi_node_sampling,ir_inplace_kernel_blacklist,gpugraph_dedup_pull_push_mode,graph_neighbor_size_percent,npu_storage_format,call_stack_level,pe_profile_fname,fast_eager_deletion_mode,gpugraph_merge_grads_segment_size,enable_neighbor_list_use_uva,new_executor_static_build,graph_metapath_split_opt,trt_ibuilder_cache,multi_node_sample_use_gpu_table,fraction_of_cuda_pinned_memory_to_use,gpugraph_debug_gpu_memory,search_cache_max_number,gpugraph_parallel_stream_num,gpugraph_parallel_copyer_split_maxsize,enable_dump_main_program,use_system_allocator,pir_apply_inplace_pass,gpugraph_enable_hbm_table_collision_stat,check_nan_inf_level,use_virtual_memory_auto_growth,sort_sum_gradient,local_exe_sub_scope_limit,gpugraph_force_device_batch_num_equal,gpugraph_enable_gpu_direct_access,fraction_of_cpu_memory_to_use,enable_api_kernel_fallback,gpugraph_sparse_table_storage_mode,graph_get_neighbor_id,enable_auto_rdma_trans,tensor_operants_mode,print_ir,gpugraph_offload_gather_copy_maxsize,dygraph_debug,eager_delete_tensor_gb,new_executor_serial_run,gpugraph_storage_mode,fleet_executor_with_standalone,run_kp_kernel,enable_pir_in_executor_trace_run,paddle_num_threads,reader_queue_speed_test_mode,max_inplace_grad_add,enable_opt_get_features,executor_log_deps_every_microseconds,low_precision_op_list I0725 17:11:15.116389 4163205824 init.cc:105] After Parse: argc is 2 I0725 17:11:15.116581 4163205824 os_info.cc:117] SetCurrentThreadName MainThread I0725 17:11:15.116652 4163205824 pybind.cc:2104] Initialize tensor operants successfully I0725 17:11:15.157564 4163205824 amp_auto_cast.cc:106] -- The size of all_ops: 1154 -- I0725 17:11:15.157774 4163205824 amp_auto_cast.cc:107] -- The size of supported_ops: 118 -- I0725 17:11:15.157793 4163205824 amp_auto_cast.cc:108] -- The size of unsupported_ops: 1036 -- I0725 17:11:15.254724 4163205824 pybind.cc:1791] Cannot use get_all_custom_device_type because you have installedCPU/GPU version PaddlePaddle. If you want to use get_all_custom_device_type, please try to install CustomDevice version PaddlePaddle by: pip install paddlepaddle I0725 17:11:15.316947 4163205824 imperative.cc:691] Tracer(0x600002474640) set expected place Place(cpu) I0725 17:11:15.317190 4163205824 global_value_getter_setter.cc:191] set FLAGS_enable_pir_api to False I0725 17:11:15.317199 4163205824 global_value_getter_setter.cc:191] set FLAGS_enable_pir_api to False 2.6.1 2.8.1 [2024/07/25 17:11:15] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=False, use_mlu=False, ir_optim=True, use_tensorrt=False, min_subgraph_size=15, precision='fp32', gpu_mem=500, gpu_id=0, image_dir=None, page_num=0, det_algorithm='DB', det_model_dir='/Users/liubingxing/.paddleocr/whl/det/ch/ch_PP-OCRv4_det_infer', det_limit_side_len=960, det_limit_type='max', det_box_type='quad', det_db_thresh=0.3, det_db_box_thresh=0.6, det_db_unclip_ratio=1.5, max_batch_size=10, use_dilation=False, det_db_score_mode='fast', det_east_score_thresh=0.8, det_east_cover_thresh=0.1, det_east_nms_thresh=0.2, det_sast_score_thresh=0.5, det_sast_nms_thresh=0.2, det_pse_thresh=0, det_pse_box_thresh=0.85, det_pse_min_area=16, det_pse_scale=1, scales=[8, 16, 32], alpha=1.0, beta=1.0, fourier_degree=5, rec_algorithm='SVTR_LCNet', rec_model_dir='/Users/liubingxing/.paddleocr/whl/rec/ch/ch_PP-OCRv4_rec_infer', rec_image_inverse=True, rec_image_shape='3, 48, 320', rec_batch_num=6, max_text_length=25, rec_char_dict_path='/Users/liubingxing/Library/Python/3.9/lib/python/site-packages/paddleocr/ppocr/utils/ppocr_keys_v1.txt', use_space_char=True, vis_font_path='./doc/fonts/simfang.ttf', drop_score=0.5, e2e_algorithm='PGNet', e2e_model_dir=None, e2e_limit_side_len=768, e2e_limit_type='max', e2e_pgnet_score_thresh=0.5, e2e_char_dict_path='./ppocr/utils/ic15_dict.txt', e2e_pgnet_valid_set='totaltext', e2e_pgnet_mode='fast', use_angle_cls=True, cls_model_dir='/Users/liubingxing/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer', cls_image_shape='3, 48, 192', label_list=['0', '180'], cls_batch_num=6, cls_thresh=0.9, enable_mkldnn=False, cpu_threads=10, use_pdserving=False, warmup=False, sr_model_dir=None, sr_image_shape='3, 32, 128', sr_batch_num=1, draw_img_save_dir='./inference_results', save_crop_res=False, crop_res_save_dir='./output', use_mp=False, total_process_num=1, process_id=0, benchmark=False, save_log_path='./log_output/', show_log=True, use_onnx=False, return_word_box=False, output='./output', table_max_len=488, table_algorithm='TableAttn', table_model_dir=None, merge_no_span_structure=True, table_char_dict_path=None, layout_model_dir=None, layout_dict_path=None, layout_score_threshold=0.5, layout_nms_threshold=0.5, kie_algorithm='LayoutXLM', ser_model_dir=None, re_model_dir=None, use_visual_backbone=True, ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ocr_order_method=None, mode='structure', image_orientation=False, layout=True, table=True, ocr=True, recovery=False, use_pdf2docx_api=False, invert=False, binarize=False, alphacolor=(255, 255, 255), lang='ch', det=True, rec=True, type='ocr', savefile=False, ocr_version='PP-OCRv4', structure_version='PP-StructureV2') I0725 17:11:15.749331 4163205824 generator.cc:200] initial seed: 8088200801436357, cpu engine: 0x178b09430

后面就卡了

yaowt05 commented 1 month ago

把paddlepaddle升级到3.0.0b0或高就没这个问题了,但是目前paddlepaddle没有M系列芯片的加速功能