From 4615c55696dc49eb67daa66bd3b9a017a3b2ade2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Wed, 8 Jan 2025 16:31:41 +0800 Subject: [PATCH] . --- cpp/LunaOCR/models.txt | 39 +++++++++++++++++++++++++++ py/LunaTranslator/ocrengines/local.py | 11 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 cpp/LunaOCR/models.txt diff --git a/cpp/LunaOCR/models.txt b/cpp/LunaOCR/models.txt new file mode 100644 index 00000000..d2e4c422 --- /dev/null +++ b/cpp/LunaOCR/models.txt @@ -0,0 +1,39 @@ +ja +https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv4/multilingual/japan_PP-OCRv4_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/japan_dict.txt +zh +https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/ppocr_keys_v1.txt +en +https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv4/english/en_PP-OCRv4_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/en_dict.txt +cht +https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv3/multilingual/chinese_cht_PP-OCRv3_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/chinese_cht_dict.txt +ko +https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv4/multilingual/korean_PP-OCRv4_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/korean_dict.txt +ru/uk +https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv3/multilingual/cyrillic_PP-OCRv3_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/cyrillic_dict.txt +ar +https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar +https://paddleocr.bj.bcebos.com/PP-OCRv4/multilingual/arabic_PP-OCRv4_rec_infer.tar +https://github.com/PaddlePaddle/PaddleOCR/blob/main/ppocr/utils/dict/arabic_dict.txt + + + +ml的检测效果很烂,所以都用的en的检测器 +没有ru的rec,所以用cyrillic简单替代 + + +paddle2onnx +paddle2onnx --model_dir ./ --model_filename inference.pdmodel --params_filename inference.pdiparams --save_file 1.onnx --opset_version 11 --enable_onnx_checker True + +https://github.com/PaddlePaddle/PaddleOCR/issues/1048 这里面有很多其他语言的,但转换onnx不管用 \ No newline at end of file diff --git a/py/LunaTranslator/ocrengines/local.py b/py/LunaTranslator/ocrengines/local.py index 17eb943c..50e7b3b0 100644 --- a/py/LunaTranslator/ocrengines/local.py +++ b/py/LunaTranslator/ocrengines/local.py @@ -154,7 +154,16 @@ def question(): def callback(): langs = getallsupports() supportlang.setText("_,_".join([getlang_inner2show(f) for f in langs])) - _allsupports = ["ja", "en", "zh", "cht", "ko", "ru"] + _allsupports = [ + Languages.Japanese, + Languages.English, + Languages.Chinese, + Languages.TradChinese, + Languages.Korean, + Languages.Russian, + Languages.Arabic, + Languages.Ukrainian, + ] allsupports.clear() for l in _allsupports: if l not in langs: