Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为整页 90°、180°、270° 倾转增加可选的纸张方向识别第一阶段:先分类并校正整页,再执行 DET → 文本行 CLS → REC。返回的行框和 CTC 字符框仍使用原始输入图坐标,已有加载方式保持兼容。
模型与接入
Sdcb.SimdPaddleOCR.Models.DocumentOrientationNuGet 项目,只依赖ModelProvider,不合并到现有中文模型包。PP-LCNet_x1_0_doc_ori,支持 0°、90°、180°、270°。PP-LCNet_x1_0_textline_ori仅支持 0°/180°,也已下载并独立导出为 ONNX,保留现有文本行分类模型。PaddleOcrAll.Load/LoadAsync接收独立方向 provider;可单独设置后端、线程预算、置信度阈值或关闭阶段。转换与算子
3.5763e-7,文本行模型4.1724e-7,全部最高分类一致。验证
本机 i7-12700、32 GB RAM、RTX 3060 12 GiB,500×500 样例(16 行,预先旋转 90°),单请求连续运行,各模式两轮、每轮 20 秒;耗时含预处理,完整 OCR 含整页旋转,排除模型加载和 JPEG 解码:
完整 OCR 在该样例上约快 2.41 倍;CPU 占用按 20 个逻辑处理器归一化。CPU 方向第二轮存在长尾,以上平均包含两轮全部调用。GPU/显存指标为整卡读数,包含桌面和其他程序;完整基线、P95、峰值和采样记录见资源报告。方向功能的 GPU 实测覆盖本机 Vulkan,其他设备的方向模型性能未在本次本机测试中验证。
接入、转换复现与验证记录:
docs/document-orientation.mddocs/document-orientation-validation.jsondocs/resource-performance.mddocs/resource-performance-validation.json使用示例: