Commit Graph
111 Commits
Author SHA1 Message Date
JinmingMei 29b812fcac feat(python): add PP-OCRv6 paddle backend support (#696)
* feat(python): add PP-OCRv6 paddle backend support

- init_predictor + device_config: add PPOCRV6 to PPOCRV5 branches (PIR format, enable_new_ir/new_executor)

- have_key + get_character_list: read character_dict from inference.yml instead of always returning False

- default_models.yaml: add paddle.PP-OCRv6 det+rec (tiny/small/medium), rec has no dict_url (dict from yml)

- test_engine.py: add EngineType.PADDLE to v6 det/rec parametrize

- Verified: v6 paddle tests pass; v4/v5 paddle regression tests pass

* refactor(python): revert have_key workaround, use dict_url for paddle v6 rec

Now that dict files are available on RapidAI/RapidOCR, revert the have_key/get_character_list workaround that read character_dict from inference.yml. Add dict_url to paddle v6 rec entries pointing to the official dict files.

- paddle/main.py: have_key returns False, get_character_list returns [], remove yml_path logic

- default_models.yaml: add dict_url to paddle v6 rec (tiny/small/medium)

- init_predictor and device_config v6 branches remain (required for PIR format)
2026-06-26 08:32:26 +08:00
SWHL 4f4d675a79 chore: update files 2026-06-23 09:54:53 +08:00
SWHL 92c2d93a40 test: update PP-OCRv4/v5 unit testings 2026-06-22 22:07:04 +08:00
SWHL 1be3e8980c test: update pp-ocrv6 unit testing 2026-06-22 18:41:51 +08:00
JinmingMei 9fe06b676c feat(python): support PP-OCRv6 (onnxruntime + openvino, det + rec) (#692)
* feat(python): support PP-OCRv6 for onnxruntime and openvino

Add PP-OCRv6 rec and det models (tiny/small/medium) for onnxruntime and openvino engines. v6 ships no cls model; reuse PP-OCRv5 cls.

- typings.py: add OCRVersion.PPOCRV6 and ModelType.TINY/SMALL/MEDIUM

- default_models.yaml: add PP-OCRv6 blocks under onnxruntime/openvino with PaddlePaddle official ModelScope URLs, verified SHA256, and dict_url (PaddleOCR dict files)

Verified end-to-end on ch_en_num.jpg with v6 small det+rec + v5 cls (onnxruntime): 18 text lines recognized correctly.

* fix(python): use uniquely-named PP-OCRv6 model URLs to avoid cache collision

PP-OCRv6 official ONNX exports are all named inference.onnx, causing det and rec models to overwrite each other in RapidOCR's cache (cache_dir/Path(url).name). Switch model_dir/dict_url to a mirror with unique filenames (ch_PP-OCRv6_<task>_<size>.onnx) under modelscope.cn/models/jaminmei/PP-OCRv6-onnx@v1.0. SHA256 unchanged (byte-identical files, renamed only).

Verified onnxruntime + openvino: no more redownload-on-collision; second run is pure cache hit.

* test(python): add PP-OCRv6 det/rec unit tests for onnxruntime and openvino

Mirror the test_ppocrv5_det/rec_mobile pattern. v6 small det on ch_en_num.jpg -> 18 boxes; v6 small rec on text_rec.jpg -> '韩国小馆'. Parametrized over the two engines v6 supports (ONNXRUNTIME, OPENVINO). Existing 100 tests unaffected (verified via collect-only).

Verified: 4 new tests pass (onnxruntime + openvino x det/rec).

* chore(python): switch PP-OCRv6 model URLs to official RapidAI/RapidOCR repo

- det/rec x tiny/small/medium now point to modelscope.cn/RapidAI/RapidOCR (official SWHL conversion, not contributor mirror)

- update SHA256 to the official files' hashes

- drop rec dict_url: official ONNX embeds the character list in metadata (session.have_key() path), matching v4/v5 onnx convention

- verified: 4 v6 unit tests pass; det benchmark Hmean identical to prior mirror-based run (0.8263/0.8492/0.8421 for tiny/small/medium)
2026-06-18 21:18:58 +08:00
SWHL 1b982078df fix: fixed issue #694 2026-06-17 10:57:41 +08:00
SWHL 2efe31f0cc fix: fixed issue #682 2026-06-11 18:54:58 +08:00
SWHL 7b2d368ac6 fix: fixed dml typo 2026-05-22 14:45:35 +08:00
SWHL 49b4fcb44c fix(cli): handle language option and empty visualization results
- pass --lang_type into RapidOCR recognition config
- skip CLI visualization when OCR or word results are empty
- validate parameter update keys before applying config updates
- add regression tests for CLI language, empty visualization, and invalid params
2026-04-27 16:51:56 +08:00
SWHL ece967983d test: add cls unit testings 2026-04-07 18:47:47 +08:00
SWHL 8ea96265b5 feat(python): add model_root_dir and download_models (API + CLI) 2026-03-19 17:27:44 +08:00
SWHL 80bbdc9615 test(tensorrt): skip TensorRT tests when not installed and exclude from parametrized suites 2026-02-26 17:34:30 +08:00
locviettriandCursor b132a915e7 feat(inference_engine): add TensorRT engine support (#623)
* feat(inference_engine): add TensorRT engine support

- Add TensorRT inference session with dynamic shape support
- Implement automatic engine building and caching per GPU architecture
- Add pre-allocated buffers with pinned memory optimization
- Support FP16/FP32/INT8 precision modes
- Add optimization profiles for det/rec/cls models
- Include comprehensive error handling and resource cleanup
- Add unit tests for TensorRT engine (skipped when unavailable)
- Add TensorRT configuration section in config.yaml

* fix(tensorrt): dynamically allocate output buffers to prevent overflow

* Update test_engine.py with TensorRT support final version

* feat(tensorrt): add model_type to engine cache key

- Include model_type in TensorRT engine cache key generation
- Ensures proper cache differentiation based on model_type

* fix(tensorrt): update maximum shape configurations for input and output tensors

- Increased max_shape values in config.yaml and engine_builder.py to 2048 for both detection and recognition tasks.
- Updated default maximum shapes in memory_utils.py to reflect the new limits for input and output buffers.

* feat(tensorrt): implement square input handling for MULTI models

- Added functionality to check if the model requires square input based on configuration.
- Implemented padding of input to square shape and cropping of output back to original dimensions.
- Introduced methods to determine maximum profile size and handle square input requirements for TensorRT inference.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-05 08:09:21 +08:00
SWHL 3a4a91020b test(mnn): add mnn unit testings 2026-01-28 22:18:58 +08:00
SWHL 5cd7de1e47 refactor: refactor paddle inference code (#622)
* refactor: refactor paddle inference code

* fix(paddle): correct typo and improve device env setup
2026-01-05 21:19:25 +08:00
SWHL 8487133fc5 feat: update five multi language files (#619)
* feat: update five multi language files

* feat(rec): enable RTL text display for Arabic

* test(rec): add arabic, cyrillic, devanagari, ta and te unit testings

* test(rec): remove duplicate cyrillic unit testing

* feat(rec): update url to v3.5.0
2025-12-26 21:24:58 +08:00
SWHL 787819457f fix: fixed issue #566 (#573)
* chore: update files

* chore: update files

* chore: refacter torch config

* chore: refacter torch infersession

* chore: refacter torch infersession

* test: change image url from github to modelscope
2025-11-07 20:00:33 +08:00
SWHL 13fb8cc8db fix: fixed issue #542 (#564)
* fix: fixed issue #542

* test: update the image of the test cls

* test: update the ground truth of the test cls image
2025-10-11 21:40:00 +08:00
SWHL 32dad48ebb fix: fixed issue #555
* fix: fixed issue #555

* chore: refactor code

* chore: refactor code

* chore: refactor code

* chore: refactor code

* chore: refactor code
2025-09-30 17:44:20 +08:00
SWHL 017b8fd5c7 feat: add en/el/th ppocr_v5_rec_mobile paddle/onnx/openvino (#546)
* feat: add en/el/th ppocr_v5_rec_mobile paddle/onnx/openvino

* test: change to a more secure code
2025-09-06 17:50:05 +08:00
SWHL 336e6424a5 fix: fixed issue #531 2025-09-03 21:58:15 +08:00
SWHL 480abaf854 chore: remove rapidocr_paddle/torch/onnxruntime/openvion code 2025-07-29 08:08:48 +08:00
SWHL 66e00f4beb feat(rapidocr): update ppocrv5 minor language config and unit testings 2025-07-27 18:02:19 +08:00
SWHL c50038bc1e feat(rapidocr): add korean ppocrv5 config and update uniting testing 2025-07-27 17:54:35 +08:00
SWHL 78b39ca378 feat(rapidocr): support ppocr v5 minor language model(korean / latin / eslav) (#516)
* feat(rapidocr): add korean ppocrv5 config and update uniting testing

* feat: support latin ppocrv5 model(paddle/ort)

* feat: support eslav ppocrv5 model(paddle/ort)

* feat(rapidocr): update model version
2025-07-27 17:51:02 +08:00
SWHL 4c4bcab0be feat(rapidocr): add font_path and lang_type parameter of cli 2025-07-27 09:15:12 +08:00
SWHL 20cbc41e36 test: add to_json and to_markdown unit testings 2025-07-27 08:52:35 +08:00
SWHL 1797850c15 feat(rapidocr): add ppocr v5 torch version (#511)
* feat: support torch ppocrv5 det

* feat: support torch ppocrv5 rec

* chore: update files

* chore: update files

* test: add ppocrv5 torch unit testings

* fix: fix typos
2025-07-23 22:08:31 +08:00
SWHL 0b2d7f0d24 test: update unit testing when adjusting the format of returning word box 2025-06-18 08:22:56 +08:00
SWHL 0190646256 fix(rapidoicr): fixed issue #446 (#453)
* fix(rapidoicr): fixed issue #446

* test(rapidocr): remove pdb code
2025-06-10 21:45:15 +08:00
SWHL 41d5824e13 feat: adapt PR #451
* feat: adapt CANN of onnxruntime (PR #428)

* chore: fix typos

* docs: update README

* fix(rapidocr): fixed issue #438

* chore: update files

* chore: update files

* chore: update files
2025-06-10 20:36:41 +08:00
SWHL dcbe0d7efa test: add unit testings of issue 440 (#445) 2025-06-06 22:42:41 +08:00
SWHL 5f86f514dd feat: support PP-OCRv5 (#437)
* chore: add v5 det model path

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files
2025-06-01 10:50:02 +08:00
SWHL 4d35ed272a tests(rapidocr): update tests of ch_doc_server 2025-05-16 19:39:47 +08:00
SWHL 80c72f54e9 feat(rapidocr): integrated PP-OCRv4_dervr_rec-d oc model (#426)
* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files
2025-05-16 09:27:01 +08:00
SWHL 5776a55e8f feat(return_word_box): support word box of English and number text (#423)
* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: update files

* chore: format code

* chore: format code

* chore: format code
2025-05-13 20:28:40 +08:00
SWHL fbaaaba486 fix(rapidocr): fixed issue #394 (#411)
* chore(rapidocr): add model SHA256

* chore(rapidocr): add model SHA256

* docs: update online demo link

* chore: update model path

* chore: update files

* chore: update files

* chore: update files

* fix(rapidocr): fixed paramter of DownloadFile
2025-04-25 20:39:38 +08:00
SWHLandCopilot d48f31e815 fix(rapidocr): fixed issue #381 #377 (#384)
* chore: update files

* fix(rapidocr): fixed issue #381

* chore: update demo

* Update python/setup.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-03 22:01:34 +08:00
SWHL b256f83316 fix(vis_result): support to download direct font file 2025-03-31 21:11:14 +08:00
SWHL 992cdf9b8b test(rapidocr): update vis unit tests 2025-03-26 09:58:16 +08:00
SWHL 202dfb91fc feat(rapidocr): support to other language ocr and update visualization (#369)
* fix(vis_result): support to download direct font file

* chore: update files

* feat(rapidocr): update vis

* feat(rapidocr): update vis
2025-03-26 09:41:23 +08:00
SWHL 47418c2005 feat(rapidocr): support img url as input and optimize vis (#356)
* feat(rapidocr): support image url input

* feat(rapidocr): support img url as input and optimize vis
2025-03-12 09:18:08 +08:00
SWHL 2a420e013e fix(rapidocr): complete parsing parameters 2025-03-09 10:06:04 +08:00
SWHL 4beb30ec79 feat: optimize server model 2025-03-04 09:44:16 +08:00
SWHL 246cb1c321 chore: update files 2025-02-18 22:35:32 +08:00
SWHL f7c0ab1fc0 chore: update files 2025-02-18 09:42:44 +08:00
SWHL e044c3fa5e chore: update files 2025-02-17 22:25:21 +08:00
SWHL 6de7194647 chore: update files 2025-02-14 14:13:48 +08:00
SWHL 6a2b9e5034 chore: update files 2025-02-13 22:22:01 +08:00
SWHL 6189f611b6 chore: update files 2025-02-13 10:37:25 +08:00