-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
python rest_api/application.py 8891运行失败 #3242
Comments
看上去是paddleocr的问题,请确保paddleocr是最新版,并且运行paddleocr的代码没问题 |
请问应该怎么检查paddleocr的代码有没有问题?我安装的paddleocr版本是2.6,应该是最新的。 |
解决方法请参考paddleocr的issue: PaddlePaddle/PaddleOCR#1964
|
看起来真有问题。 Python 3.7.13 (default, Mar 28 2022, 08:03:21) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> use_gpu=False
>>> from paddleocr import PaddleOCR
>>> recognize = PaddleOCR(use_angle_cls=True, lang='ch', use_gpu=use_gpu)
[2022/09/11 16:24:54] ppocr DEBUG: Namespace(alpha=1.0, benchmark=False, beta=1.0, cls_batch_num=6, cls_image_shape='3, 48, 192', cls_model_dir='C:\\Users\\刘源东/.paddleocr/whl\\cls\\ch_ppocr_mobile_v2.0_cls_infer', cls_thresh=0.9, cpu_threads=10, crop_res_save_dir='./output', 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_fce_box_type='poly', det_limit_side_len=960, det_limit_type='max', det_model_dir='C:\\Users\\刘源东/.paddleocr/whl\\det\\ch\\ch_PP-OCRv3_det_infer', det_pse_box_thresh=0.85, det_pse_box_type='quad', det_pse_min_area=16, det_pse_scale=1, det_pse_thresh=0, det_sast_nms_thresh=0.2, det_sast_polygon=False, det_sast_score_thresh=0.5, draw_img_save_dir='./inference_results', 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_score_thresh=0.5, e2e_pgnet_valid_set='totaltext', enable_mkldnn=False, fourier_degree=5, gpu_mem=500, help='==SUPPRESS==', image_dir=None, image_orientation=False, ir_optim=True, kie_algorithm='LayoutXLM', label_list=['0', '180'], lang='ch', layout=True, layout_dict_path=None, layout_model_dir=None, layout_nms_threshold=0.5, layout_score_threshold=0.5, max_batch_size=10, max_text_length=25, merge_no_span_structure=True, min_subgraph_size=15, mode='structure', ocr=True, ocr_order_method=None, ocr_version='PP-OCRv3', output='./output', precision='fp32', process_id=0, rec=True, rec_algorithm='SVTR_LCNet', rec_batch_num=6, rec_char_dict_path='D:\\Programs\\miniconda3\\envs\\ml\\lib\\site-packages\\paddleocr\\ppocr\\utils\\ppocr_keys_v1.txt', rec_image_shape='3, 48, 320', rec_model_dir='C:\\Users\\刘源东/.paddleocr/whl\\rec\\ch\\ch_PP-OCRv3_rec_infer', recovery=False, save_crop_res=False, save_log_path='./log_output/', save_pdf=False, scales=[8, 16, 32], ser_dict_path='../train_data/XFUND/class_list_xfun.txt', ser_model_dir=None, shape_info_filename=None, show_log=True, sr_batch_num=1, sr_image_shape='3, 32, 128', sr_model_dir=None, structure_version='PP-Structurev2', table=True, table_algorithm='TableAttn', table_char_dict_path=None, table_max_len=488, table_model_dir=None, total_process_num=1, type='ocr', use_angle_cls=True, use_dilation=False, use_gpu=False, use_mp=False, use_onnx=False, use_pdserving=False, use_space_char=True, use_tensorrt=False, use_xpu=False, vis_font_path='./doc/fonts/simfang.ttf', warmup=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Programs\miniconda3\envs\ml\lib\site-packages\paddleocr\paddleocr.py", line 501, in __init__
super().__init__(params)
File "D:\Programs\miniconda3\envs\ml\lib\site-packages\paddleocr\tools\infer\predict_system.py", line 46, in __init__
self.text_detector = predict_det.TextDetector(args)
File "D:\Programs\miniconda3\envs\ml\lib\site-packages\paddleocr\tools\infer\predict_det.py", line 137, in __init__
args, 'det', logger)
File "D:\Programs\miniconda3\envs\ml\lib\site-packages\paddleocr\tools\infer\utility.py", line 274, in create_predictor
predictor = inference.create_predictor(config)
RuntimeError: (NotFound) Cannot open file C:\Users\刘源东/.paddleocr/whl\det\ch\ch_PP-OCRv3_det_infer/inference.pdmodel, please confirm whether the file is normal.
[Hint: Expected static_cast<bool>(fin.is_open()) == true, but received static_cast<bool>(fin.is_open()):0 != true:1.] (at C:\home\workspace\Paddle_release\paddle\fluid\inference\api\analysis_predictor.cc:1500)
>>> img_path = 'your_img_path'
>>> result =recognize.ocr(img_path, cls=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'recognize' is not defined |
请确保安装路径不要有中文哈,建议安装在D盘或者E盘,并且路径不要有中文 |
我其实用miniconda安装的python,还放在D盘(没有中文名)。不知道为什么会去C盘找inference.pdmodel。 |
https://gitee.com/paddlepaddle/PaddleOCR/issues/I4N5S8 试试,或者把您的中文人名换成英文 |
这中文路径没法改吧?已经装了这么多程序,如果改了怕出乱子。 SUPPORT_DET_MODEL = ['DB']
VERSION = '2.6.0.1'
SUPPORT_REC_MODEL = ['CRNN', 'SVTR_LCNet']
# 修改开始
HUB_HOME = os.environ.get('HUB_HOME')
BASE_DIR = ""
if 'HUB_HOME' in os.environ:
BASE_DIR = os.getenv('HUB_HOME') + '/.paddleocr/'
else:
BASE_DIR = os.path.expanduser("~/.paddleocr/")
# 修改结束
DEFAULT_OCR_MODEL_VERSION = 'PP-OCRv3'
SUPPORT_OCR_MODEL_VERSION = ['PP-OCR', 'PP-OCRv2', 'PP-OCRv3']
DEFAULT_STRUCTURE_MODEL_VERSION = 'PP-Structurev2'
SUPPORT_STRUCTURE_MODEL_VERSION = ['PP-Structure', 'PP-Structurev2'] |
把hub_home换成其他路径,写成D盘或者E盘的某个路径即可。您这样修改hub_home是环境变量,需要您自己指定hub_home。 |
我尝试写了一下,您看看:
请确保 |
解决,谢谢。 |
在Win11安装PaddlePaddle 2.3.2。在运行WINDOWS环境下搭建端到端语义检索系统的过程中,
python rest_api/application.py 8891
运行失败了,报错如下:The text was updated successfully, but these errors were encountered: