基于百度飞桨paddle的paddlepaddle2.4.2等系列项目的运行

news/2024/11/8 9:23:23/

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的paddlepaddle>paddlepaddle2.4.2

conda activate test

conda install paddlepaddle>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

此处提供链接参考

【jupyter notebook】中插件 nbextensions 安装失败分析与解决方法_modulenotfounderror: no module named 'notebook.nbe-CSDN博客

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.htmlimport 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-packagesdeclare_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.htmlimport 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-packagesdeclare_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 -

浏览器:

http://localhost:5173/


http://www.ppmy.cn/news/1545316.html

相关文章

梧桐数据库浅谈查询优化技巧

在数据库应用中&#xff0c;梧桐数据库查询的性能直接影响到应用的响应速度和用户体验。一个高效的梧桐数据库查询可以显著提高数据库的响应速度&#xff0c;降低资源消耗。本文将介绍一些常用的梧桐数据库查询优化技术&#xff0c;并提供实际案例来展示如何应用这些技术来提升…

PGMP练-DAY11

DAY111*1. A program is completed and the expected benefits realized. Before executing the transition and closing out the program, what should the program manager do?一个项目集已完成&#xff0c;预期收益已实现。在执行移交和关闭项目集之前&#xff0c;项目集经…

用uio正确映射读写内存mmap

在 OpenLunar 系统中&#xff0c;要通过 UIO 映射出可读写的内存&#xff0c;可以按照以下步骤确保正确配置和使用 UIO&#xff0c;以便映射后的内存具有读写权限。 ### 1. 配置设备树 (DTS) 文件 在 OpenLunar 系统中&#xff0c;通常通过设备树&#xff08;DTS&#xff09;文…

【NOIP提高组】合唱队形

【NOIP提高组】合唱队形 C语言Java &#x1f490;The Begin&#x1f490;点点关注&#xff0c;收藏不迷路&#x1f490; N位同学站成一排&#xff0c;音乐老师要请其中的(N-K)位同学出列&#xff0c;使得剩下的K位同学排成合唱队形。 合唱队形是指这样的一种队形&#xff1a;设…

React中类组件和函数组件的理解和区别

react代码模块分为类组件和函数组件。 从语法和定义、内部状态管理、生命周期、性能、可读性和维护性、上下文、集成状态管理库等角度对比React中类组件和函数组件。 1、语法和定义 类组件&#xff1a; 使用 ES6 的类&#xff08;class&#xff09;语法定义的 React 组件。…

网页版五子棋——用户模块(服务器开发)

前一篇文章&#xff1a;网页版五子棋—— WebSocket 协议-CSDN博客 目录 前言 一、编写数据库代码 1.数据库设计 2.配置 MyBatis 3.创建实体类 4.创建 UserMapper 二、前后端交互接口 1.登录接口 2.注册接口 3.获取用户信息 三、服务器开发 1.代码编写 2.测试后端…

2024年网鼎杯青龙组|MISC全解

转载或摘抄时请标明出处 MISC01 wdbflag{22226aba1d98c4302a6f508cad7da5d8} MISC02 一把梭工具没有任何结果&#xff0c;估计缺少符号表&#xff0c;直接strings flag > out.txt导出后慢慢找线索 在桌面上发现了png和txt文件&#xff0c;用文件名做一次筛选 第一行发现bas…

【机器学习】机器学习回归模型全解析:线性回归、多项式回归、过拟合与泛化、向量相关性与岭回归的理论与实践

&#x1f497;&#x1f497;&#x1f497;欢迎来到我的博客&#xff0c;你将找到有关如何使用技术解决问题的文章&#xff0c;也会找到某个技术的学习路线。无论你是何种职业&#xff0c;我都希望我的博客对你有所帮助。最后不要忘记订阅我的博客以获取最新文章&#xff0c;也欢…