Commit Graph
566 Commits
Author SHA1 Message Date
SWHL 096293330e fix: improve IDE support for lazy package exports 2026-07-09 11:22:07 +08:00
SWHL c4db82f7ac test: remove invalid unit testings of tensorrt module 2026-07-09 06:10:27 +08:00
SWHL bce0c99be9 test: add PP-OCRv3 mobile unit testings 2026-07-08 21:31:33 +08:00
SWHL 0fa7a9664c fix: fixed issue #695 2026-07-08 19:23:17 +08:00
SWHL 802c05647f fix: fixed issue #709 2026-07-08 16:04:02 +08:00
SWHL b64a46ffd4 fix: align the performance of the torch version of the PP-OCRv6 Rec tiny model 2026-07-04 22:42:55 +08:00
SWHL 7fe716f8e3 chore: update pre-commit rule 2026-07-02 21:27:14 +08:00
SWHL 28490093df chore: add missing scripts of PyTorch module 2026-07-02 17:58:08 +08:00
SWHL 370f01d0a8 feat: support PP-OCRv6 PyTor as the inference engine 2026-07-02 17:54:27 +08:00
SWHL c18432567f fix: adjust PP-OCRv6 Paddle model key names in YAML config 2026-06-26 16:52:53 +08:00
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
SWHL 52fdd1e21a chore: update files 2026-06-22 18:39:25 +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 86b48d2c96 feat: optimize the wheel packaging process (#687)
* chore: add pyproject toml configuration

* build: migrate RapidOCR wheel packaging to pyproject.toml

- add PEP 517 setuptools build configuration
- derive package version from git tags via setuptools-scm
- move wheel model preparation into an explicit tools script
- generate MANIFEST.in for default model assets before building
- avoid importing rapidocr during package metadata generation

* ci: build release wheels from validated git tags

* build: align package runtime support with Python 3.8

- set Requires-Python to >=3.8
- remove Python 3.6 and 3.7 classifiers
- make wheel asset preparation script type hints Python 3.8 compatible
- clarify split between build-time and wheel runtime support
2026-06-12 17:19:53 +08:00
SWHL 2efe31f0cc fix: fixed issue #682 2026-06-11 18:54:58 +08:00
SWHL f8392300f6 fix: fixed issue #676 2026-06-10 21:44:33 +08:00
SWHL d312f67f44 refactor: optimize to package whl logic 2026-06-09 23:04:42 +08:00
SWHL a4c7382bba feat: add default download model configuration 2026-06-09 23:04:08 +08:00
SWHL e8938d8c2a refactor: optimize import 2026-06-09 23:02:06 +08:00
SWHL 7b2d368ac6 fix: fixed dml typo 2026-05-22 14:45:35 +08:00
StarLineandCopilot Autofix powered by AI 00f71b2d5e feat: update to_markdown rule (#672)
* Update to_markdown.py

修改重排规则:
中文段落
表格/多栏
标题与正文混排
OCR 框轻微倾斜

* Potential fix for pull request finding

refactor: format function call for readability
- Wrap `cls.get_gap_text` call into multi-line format
- No functional changes, only code style improvement

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

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-18 14:39:11 +08:00
SWHL 3857ff5153 build: update omegaconf version constraint 2026-05-06 09:59:20 +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 d48c4cf312 refactor: optimize model_root_dir logic 2026-04-24 11:24:49 +08:00
FeiyueHa 57dfac08d8 fix: check model_root_dir only if model_path is None (#665) 2026-04-24 10:18:43 +08:00
SWHL d4bf8f2b96 fix: add missing DEFAULT_MODEL_PATH property (#664) 2026-04-11 10:29:01 +08:00
SWHL abaaeb3043 chore: update default_model version to v3.8.0 2026-04-08 21:26:32 +08:00
SWHL 143f46242d fix: update paddle/cls/v5 model url 2026-04-08 21:17:07 +08:00
SWHL c5d1ea7f4a chore: update model name 2026-04-08 10:05:46 +08:00
SWHL ece967983d test: add cls unit testings 2026-04-07 18:47:47 +08:00
SWHL b73ec51ecf feat: add PP-OCRv5 cls module 2026-04-07 17:35:01 +08:00
SWHL 9023589c86 feat: add PP-OCRv5 cls module 2026-04-07 17:34:15 +08:00
SWHL 5ef452516d fix: added missing package import 2026-03-19 17:36:24 +08:00
SWHL 8ea96265b5 feat(python): add model_root_dir and download_models (API + CLI) 2026-03-19 17:27:44 +08:00
SWHL f7961d3d2c chore: update default_model url path 2026-03-04 23:17:44 +08:00
HighDoping 597fe059ac feat: add experimental MPS support to PyTorch backend. (#639) 2026-03-04 16:32:50 +08:00
SWHL 5aa9079e75 refactor: standardize public interface with __all__
Close issue #646
2026-02-28 23:37:25 +08:00
HighDoping 7c880e8ac9 feat(inference_engine): add experimental CoreML support for onnxruntime (#634)
* Add CoreML support for onnxruntime.

* Add more CoreML execution provider configs.
2026-02-28 18:25:00 +08:00
SWHL 9d12451b7b refactor(openvino): remove dict_url from model configs 2026-02-26 19:42:45 +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
SWHL e549f7eacc feat(inference): add get_character_list abstract method to InferSession 2026-02-26 17:32:47 +08:00
SWHL 106d4d189d fix(openvino): fixed the missing List import 2026-02-26 17:07:35 +08:00
SWHL 9108b617ab feat(openvino): support retrieving character list from model runtime info 2026-02-25 19:00:08 +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 009a210a79 chore: update default image url 2026-02-01 14:36:32 +08:00
SWHL 75d0d159d2 chore: update model list to direct version 2026-01-28 22:32:35 +08:00