日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

PaddleOCR加载chinese_ocr_db_crnn_server模型进行中英文混合预测(命令行)实践

發布時間:2025/5/22 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 PaddleOCR加载chinese_ocr_db_crnn_server模型进行中英文混合预测(命令行)实践 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. 安裝相關庫文件
# 安裝paddlehub和paddlepaddle pip install paddlehub -i https://pypi.tuna.tsinghua.edu.cn/simple pip install paddlepaddle -i https://pypi.tuna.tsinghua.edu.cn/simple # 該Module依賴于第三方庫shapely、pyclipper,使用該Module之前,請先安裝shapely、pyclipper pip install shapely -i https://pypi.tuna.tsinghua.edu.cn/simple pip install pyclipper -i https://pypi.tuna.tsinghua.edu.cn/simple

使用的是清華的源,在安裝時出現過https連接池超時的問題,換個網絡環境,多試幾次就好了。

2. 安裝預訓練模型

選擇的是識別精度相對較高的:chinese_ocr_db_crnn_server
命令是:hub install chinese_ocr_db_crnn_server==1.1.1

(venv) E:\test\PycharmProjects\PaddleStudy2>hub install chinese_ocr_db_crnn_server==1.1.1 e:\test\pycharmprojects\paddlestudy2\venv\lib\site-packages\pip\_vendor\packaging\version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major releasewarnings.warn( e:\test\pycharmprojects\paddlestudy2\venv\lib\site-packages\pip\_vendor\packaging\version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major releasewarnings.warn( 2021-03-16 08:50:50,784 - INFO - Lock 601713536 acquired on C:\Users\CTH\.paddlehub\tmp\chinese_ocr_db_crnn_server [INFO 2021-03-16 08:50:50,784 filelock.py:274] Lock 601713536 acquired on C:\Users\CTH\.paddlehub\tmp\chinese_ocr_db_crnn_server Download https://bj.bcebos.com/paddlehub/paddlehub_dev/chinese_ocr_db_crnn_server_1.1.1.tar.gz [##################################################] 100.00% Decompress C:\Users\CTH\.paddlehub\tmp\tmppwvzfx_9\chinese_ocr_db_crnn_server_1.1.1.tar.gz [##################################################] 100.00% [2021-03-16 08:51:44,000] [ INFO] - Successfully installed chinese_ocr_db_crnn_server-1.1.1 2021-03-16 08:51:44,047 - INFO - Lock 601713536 released on C:\Users\CTH\.paddlehub\tmp\chinese_ocr_db_crnn_server [INFO 2021-03-16 08:51:44,047 filelock.py:318] Lock 601713536 released on C:\Users\CTH\.paddlehub\tmp\chinese_ocr_db_crnn_server

對應的精簡版本:chinese_ocr_db_crnn_mobile
命令是:hub install chinese_ocr_db_crnn_mobile==1.1.1

3. 命令行預測

原始圖片:

命令是:hub run chinese_ocr_db_crnn_server --input_path “/PATH/TO/IMAGE”

(venv) E:\test\PycharmProjects\PaddleStudy2>hub run chinese_ocr_db_crnn_server --input_path "E:/test/PycharmProjects/PaddleStudy2/pic/0-1.jpg" e:\test\pycharmprojects\paddlestudy2\venv\lib\site-packages\pip\_vendor\packaging\version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major releasewarnings.warn( e:\test\pycharmprojects\paddlestudy2\venv\lib\site-packages\pip\_vendor\packaging\version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major releasewarnings.warn( [2021-03-16 08:53:25,582] [ WARNING] - The _initialize method in HubModule will soon be deprecated, you can use the __init__() to handle the initialization of the object W0316 08:53:25.598523 12472 analysis_predictor.cc:1145] Deprecated. Please use CreatePredictor instead. 2021-03-16 08:53:26,440 - INFO - Lock 607078624 acquired on C:\Users\CTH\.paddlehub\tmp\chinese_text_detection_db_server [INFO 2021-03-16 08:53:26,440 filelock.py:274] Lock 607078624 acquired on C:\Users\CTH\.paddlehub\tmp\chinese_text_detection_db_server Download https://bj.bcebos.com/paddlehub/paddlehub_dev/chinese_text_detection_db_server_1.0.2.tar.gz [##################################################] 100.00% Decompress C:\Users\CTH\.paddlehub\tmp\tmpvc1k5tyo\chinese_text_detection_db_server_1.0.2.tar.gz [##################################################] 100.00% [2021-03-16 08:53:55,071] [ INFO] - Successfully installed chinese_text_detection_db_server-1.0.2 2021-03-16 08:53:55,118 - INFO - Lock 607078624 released on C:\Users\CTH\.paddlehub\tmp\chinese_text_detection_db_server [INFO 2021-03-16 08:53:55,118 filelock.py:318] Lock 607078624 released on C:\Users\CTH\.paddlehub\tmp\chinese_text_detection_db_server [2021-03-16 08:53:55,118] [ WARNING] - The _initialize method in HubModule will soon be deprecated, you can use the __init__() to handle the initialization of the object [{'save_path': '', 'data': [{'text': '雙耳機配對', 'confidence': 0.9995235204696655, 'text_box_position': [[64, 63], [301, 69], [299, 119], [63, 113]]}, {'text': '首次配對方法:', 'confidence': 0.9997860193252563, 'text_box_position': [[71, 186], [336, 194], [334, 232], [70, 225]]}, {'text': '1、取出兩只耳機,再將兩只耳機放回充電盒中', 'confidence': 0.9993939399719238, 'text_box_position': [[67, 245], [767, 258], [767, 297], [67, 283]]}, {'text': '(此步驟為新機激活 )', 'confidence': 0.9379152655601501, 'text_box_position': [[116, 293], [411, 300], [410, 335], [115, 328]]}, {'text': '2、再次取出兩只耳機', 'confidence': 0.999390721321106, 'text_box_position': [[67, 339], [401, 349], [399, 384], [6 6, 374]]}, {'text': '3、刷新手機藍牙設備列表,點擊配對QCY-T1C,完成配對', 'confidence': 0.9993934035301208, 'text_box_position': [[67, 388], [937, 402], [937, 437], [67, 422]]}, {'text': '耳機取出會自動開機,若未自動開機,請充電后重新 嘗試', 'confidence': 0.990841269493103, 'text_box_position': [[80, 436], [938, 451], [938, 483], [80, 468]]}, {'text': '切換設備配對方法:', 'confidence': 0.9996602535247803, 'text_box_position': [[71, 536], [421, 536], [421, 573], [71 , 573]]}, {'text': '1、關閉A手機藍牙,耳機自動斷開進入配對模式', 'confidence': 0.9853517413139343, 'text_box_position': [[67, 590], [791, 598], [791, 636], [67, 629]]}, {'text': '2、刷新B手機藍牙設備列表,點擊配對QCY-T1C,完成配對', 'c onfidence': 0.9961883425712585, 'text_box_position': [[63, 638], [964, 649], [964, 695], [63, 684]]}, {'text': '*不支持同時連接兩臺手機,下次開機默認回連上次配對的手機', 'confidence': 0.9984445571899414, 'text_box_position': [[73, 686] , [989, 698], [989, 748], [73, 736]]}]}]

結果:

{
‘text’: ‘雙耳機配對’,
‘confidence’: 0.9995235204696655,
‘text_box_position’: [[64, 63], [301, 69], [299, 119], [63, 113]]
},
{
‘text’: ‘首次配對方法:’,
‘confidence’: 0.9997860193252563,
‘text_box_position’: [[71, 186], [336, 194], [334, 232], [70, 225]]
},
{
‘text’: ‘1、取出兩只耳機,再將兩只耳機放回充電盒中’,
‘confidence’: 0.9993939399719238,
‘text_box_position’: [[67, 245], [767, 258], [767, 297], [67, 283]]
},
{
‘text’: ‘(此步驟為新機激活)’,
‘confidence’: 0.9379152655601501,
‘text_box_position’: [[116, 293], [411, 300], [410, 335], [115, 328]]
},
{
‘text’: ‘2、再次取出兩只耳機’,
‘confidence’: 0.999390721321106,
‘text_box_position’: [[67, 339], [401, 349], [399, 384], [66, 374]]
},
{
‘text’: ‘3、刷新手機藍牙設備列表,點擊配對QCY-T1C,完成配對’,
‘confidence’: 0.9993934035301208,
‘text_box_position’: [[67, 388], [937, 402], [937, 437], [67, 422]]
},
{
‘text’: ‘耳機取出會自動開機,若未自動開機,請充電后重新嘗試’,
‘confidence’: 0.990841269493103,
‘text_box_position’: [[80, 436], [938, 451], [938, 483], [80, 468]]
},
{
‘text’: ‘切換設備配對方法:’,
‘confidence’: 0.9996602535247803,
‘text_box_position’: [[71, 536], [421, 536], [421, 573], [71, 573]]
},
{
‘text’: ‘1、關閉A手機藍牙,耳機自動斷開進入配對模式’,
‘confidence’: 0.9853517413139343,
‘text_box_position’: [[67, 590], [791, 598], [791, 636], [67, 629]]
},
{
‘text’: ‘2、刷新B手機藍牙設備列表,點擊配對QCY-T1C,完成配對’,
‘confidence’: 0.9961883425712585,
‘text_box_position’: [[63, 638], [964, 649], [964, 695], [63, 684]]
},
{
‘text’: ‘*不支持同時連接兩臺手機,下次開機默認回連上次配對的手機’,
‘confidence’: 0.9984445571899414,
‘text_box_position’: [[73, 686], [989, 698], [989, 748], [73, 736]]
}

識別效果非常好!!!

【參考文檔】
《PaddleHub一鍵OCR中文識別》
《PaddleHub》

總結

以上是生活随笔為你收集整理的PaddleOCR加载chinese_ocr_db_crnn_server模型进行中英文混合预测(命令行)实践的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。