PPASR
必看!!!
PaddleSpeech == develop --> PaddlePaddle == 2.5.0/2.5.1 PaddleSpeech <= 1.4.1 --> PaddlePaddle <= 2.4.2
1.创建虚拟环境
conda create --name test python=3.10
2.激活环境,安装ppasr的paddlepaddle2.4.2
conda activate test
conda install paddlepaddle==2.4.2 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/
安装jupyter notebook
pip install jupyter notebook
jupyter notebook --version
注意jupyter7.x以后不支持插件
可以选择安装6.x
此处提供链接参考
3.运行Jupyter Notebook
启动 默认端口启动 在终端中输入以下命令:
jupyter notebook 执行命令之后,在终端中将会显示一系列notebook的服务器信息,同时浏览器将会自动启动Jupyter Notebook。
浏览器地址栏中默认地将会显示:http://localhost:8888。其中,“localhost”指的是本机,“8888”则是端口号。
4.退出Jupyter Notebook
想要彻底退出Jupyter Notebook,需要关闭它的服务器。只需要在它启动的终端上按: Mac用户:control c Windows用户:ctrl c
5.项目运行
front
nmp i
npm run dev
back
激活python的test虚拟环境
运行routes.py
/opt/anaconda3/envs/test/bin/python /Users/lin/Desktop/ppasr/back/api/routes.py
/opt/anaconda3/envs/test/lib/python3.10/site-packages/setuptools/sandbox.py:14: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
/opt/anaconda3/envs/test/lib/python3.10/site-packages/pkg_resources/__init__.py:2832: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data] [Errno 61] Connection refused>
[nltk_data] Error loading cmudict: <urlopen error [Errno 61]
[nltk_data] Connection refused>
* Serving Flask app 'routes'
* Debug mode: on
[2024-11-07 19:58:01,777] [ INFO] _internal.py:97 - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
[2024-11-07 19:58:01,777] [ INFO] _internal.py:97 - Press CTRL+C to quit
[2024-11-07 19:58:01,779] [ INFO] _internal.py:97 - * Restarting with stat
/opt/anaconda3/envs/test/lib/python3.10/site-packages/setuptools/sandbox.py:14: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
/opt/anaconda3/envs/test/lib/python3.10/site-packages/pkg_resources/__init__.py:2832: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
declare_namespace(pkg)
[nltk_data] Error loading averaged_perceptron_tagger: <urlopen error
[nltk_data] [Errno 61] Connection refused>
[nltk_data] Error loading cmudict: <urlopen error [Errno 61]
[nltk_data] Connection refused>
[2024-11-07 19:58:14,412] [ WARNING] _internal.py:97 - * Debugger is active!
[2024-11-07 19:58:14,431] [ INFO] _internal.py:97 - * Debugger PIN: 104-557-696
[2024-11-07 19:58:45,657] [ WARNING] logging.py:46 - 'ernie-bot' will be deprecated in the future. Please use 'ernie-3.5' instead.
2024-11-07 19:58:47
Inserted user with ID: 42
[2024-11-07 19:58:47,968] [ INFO] _internal.py:97 - 127.0.0.1 - - [07/Nov/2024 19:58:47] "POST /getpolish HTTP/1.1" 200 -
[2024-11-07 19:59:05,542] [ WARNING] logging.py:46 - 'ernie-bot' will be deprecated in the future. Please use 'ernie-3.5' instead.
2024-11-07 19:59:07
Inserted user with ID: 43
[2024-11-07 19:59:07,859] [ INFO] _internal.py:97 - 127.0.0.1 - - [07/Nov/2024 19:59:07] "POST /getpolish HTTP/1.1" 200 -
[2024-11-07 20:04:23,860] [ INFO] _internal.py:97 - 127.0.0.1 - - [07/Nov/2024 20:04:23] "POST /readImage HTTP/1.1" 200 -
[2024/11/07 20:04:21] ppocr DEBUG: Namespace(help='==SUPPRESS==', use_gpu=False, use_xpu=False, use_npu=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/lin/.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/lin/.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/lin/.local/lib/python3.10/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/lin/.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, 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', ocr_version='PP-OCRv4', structure_version='PP-StructureV2')
[2024/11/07 20:04:23] ppocr DEBUG: dt_boxes num : 3, elapsed : 0.7359390258789062
[2024/11/07 20:04:23] ppocr DEBUG: cls num : 3, elapsed : 0.029176712036132812
[2024/11/07 20:04:23] ppocr DEBUG: rec_res num : 3, elapsed : 0.3469219207763672
[0.998357892036438, 0.9924399852752686, 0.9858253002166748]
[[[[421.0, 391.0], [549.0, 391.0], [549.0, 419.0], [421.0, 419.0]], ('Mashiro', 0.998357892036438)], [[[443.0, 423.0], [525.0, 420.0], [526.0, 449.0], [444.0, 451.0]], ('最棒了', 0.9924399852752686)], [[[470.0, 455.0], [500.0, 455.0], [500.0, 480.0], [470.0, 480.0]], (':P', 0.9858253002166748)]]
OCR结果图保存在../static/images/default/ocrOut/comment.png
文本信息:
[[[[421.0, 391.0], [549.0, 391.0], [549.0, 419.0], [421.0, 419.0]], ('Mashiro', 0.998357892036438)], [[[443.0, 423.0], [525.0, 420.0], [526.0, 449.0], [444.0, 451.0]], ('最棒了', 0.9924399852752686)], [[[470.0, 455.0], [500.0, 455.0], [500.0, 480.0], [470.0, 480.0]], (':P', 0.9858253002166748)]]
Mashiro 最棒了 :P
2024-11-07 20:04:23
Inserted user with ID: 44
[2024-11-07 20:05:13,273] [ INFO] _internal.py:97 - 127.0.0.1 - - [07/Nov/2024 20:05:13] "GET /getalldata HTTP/1.1" 200 -
{[{'id': 44, 'content': 'Mashiro 最棒了 :P', 'date': '2024-11-07 20:04:23'}]}
[2024-11-07 20:24:49,648] [ INFO] - Already cached /Users/lin/.paddlenlp/models/bert-base-chinese/bert-base-chinese-vocab.txt
[2024-11-07 20:24:49,665] [ INFO] - tokenizer config file saved in /Users/lin/.paddlenlp/models/bert-base-chinese/tokenizer_config.json
[2024-11-07 20:24:49,666] [ INFO] - Special tokens file saved in /Users/lin/.paddlenlp/models/bert-base-chinese/special_tokens_map.json
Building prefix dict from the default dictionary ...
[2024-11-07 20:24:59,661] [ DEBUG] __init__.py:113 - Building prefix dict from the default dictionary ...
Dumping model to file cache /var/folders/jr/2mlw59_j35bbnxrjc7xpz3lr0000gn/T/jieba.cache
[2024-11-07 20:25:00,301] [ DEBUG] __init__.py:146 - Dumping model to file cache /var/folders/jr/2mlw59_j35bbnxrjc7xpz3lr0000gn/T/jieba.cache
Loading model cost 0.686 seconds.
[2024-11-07 20:25:00,347] [ DEBUG] __init__.py:164 - Loading model cost 0.686 seconds.
Prefix dict has been built successfully.
[2024-11-07 20:25:00,347] [ DEBUG] __init__.py:166 - Prefix dict has been built successfully.
2221
2024-11-07 20:25:01
Inserted user with ID: 45
[2024-11-07 20:25:01,476] [ INFO] _internal.py:97 - 127.0.0.1 - - [07/Nov/2024 20:25:01] "POST /tts HTTP/1.1" 200 -
浏览器:
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 基于百度飞桨paddle的paddlepaddle2.4.2等系列项目的运行
发表评论 取消回复