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

ops/2024/11/8 20:40:54/

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/ops/132024.html

相关文章

基于OpenCV的相机捕捉视频进行人脸检测--米尔NXP i.MX93开发板

本篇测评由优秀测评者“eefocus_3914144”提供。 本文将介绍基于米尔电子MYD-LMX93开发板&#xff08;米尔基于NXP i.MX93开发板&#xff09;的基于OpenCV的人脸检测方案测试。 OpenCV提供了一个非常简单的接口&#xff0c;用于相机捕捉一个视频(我用的电脑内置摄像头) 1、安…

【WebRTC】视频采集模块流程的简单分析

目录 1.从摄像头获取视频帧&#xff08;CaptureInputPin::Receive()&#xff09;2.处理摄像头获取的帧&#xff08;CaptureSinkFilter::ProcessCaptureFrame())3.处理Windows层帧信息并发送到帧处理器&#xff08;VideoCaptureImpl::IncomingFrame())4.帧处理器&#xff08;Vid…

【系统架构设计师】2021年真题论文: 论面向方面的编程技术及其应用(AOP)(包括解题思路和素材)

更多内容请见: 备考系统架构设计师-专栏介绍和目录 文章目录 真题题目(2021年 试题1)解题思路面向方面的编程(AOP)技术概念和原理AOP的核心机制AOP 在软件系统开发中的应用场景AOP 应用案例分析论文素材参考真题题目(2021年 试题1) 面向过程编程是一种自顶向下的编程方…

2024MoonBit全球编程创新挑战赛参赛作品“飞翔的小鸟”技术开发指南

本文转载自 CSDN&#xff1a;https://blog.csdn.net/m0_61243965/article/details/143510089作者&#xff1a;言程序plus 实战开发基于moonbit和wasm4的飞翔的小鸟游戏 游戏中&#xff0c;玩家需要通过上下左右按键控制Bird&#xff0c;在不断移动的障碍pipe之间穿梭&#xf…

网络技术---网络通信概述

网络通信概述 网络通信概述一、网络通信的层次二、OSI七层网络模型三、TCP/IP五层模型1. 物理层1.1 物理层作用1.2 物理层概述1.3 信号调制1.4 信道复用技术 2. 数据链路层2.1 数据链路层作用2.2 点对点数据链路层三个基本问题2.3 滑动窗口协议2.4 以太网 3. 网络层3.1 概述3.2…

【Python】anancode怎么快速找到site-packages 的路径位置

在Python环境中&#xff0c;site_packages是一个特殊的目录&#xff0c;用于存放第三方库文件&#xff0c;我们所有运行的python包&#xff0c;就在这个文件夹底下。 要查找site-packages的路径&#xff0c;你可以使用以下几种方法&#xff1a; 方法1&#xff1a;使用Python解…

关于Websocket

Websocket的基本概念 Websocket是一个“应用层协议”&#xff0c;和HTTP地位是对等的。都是基于传输层的TCP实现的一个广泛被使用的应用层协议。这个协议可以实现服务器主动给客户端推送数据这样的功能。 websocket报文格式 简单了解一下Websocket的报文格式&#xff1a; FIN表…

[ 杂谈 ] 浅谈网络安全学习和职场成功之路及招聘网站的重要性

&#x1f36c; 博主介绍 &#x1f468;‍&#x1f393; 博主介绍&#xff1a;大家好&#xff0c;我是 _PowerShell &#xff0c;很高兴认识大家~ ✨主攻领域&#xff1a;【渗透领域】【数据通信】 【通讯安全】 【web安全】【面试分析】 &#x1f389;点赞➕评论➕收藏 养成习…