{"id":18273609,"url":"https://github.com/rapidai/rapidocrncnn","last_synced_at":"2025-04-05T03:30:29.430Z","repository":{"id":61633918,"uuid":"353591537","full_name":"RapidAI/RapidOcrNcnn","owner":"RapidAI","description":"RapidOCR ncnn 推理","archived":false,"fork":false,"pushed_at":"2023-09-19T06:53:14.000Z","size":289,"stargazers_count":61,"open_issues_count":4,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T21:21:07.175Z","etag":null,"topics":["ncnn","ocr"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RapidAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-01T06:00:57.000Z","updated_at":"2025-03-20T00:10:39.000Z","dependencies_parsed_at":"2023-01-20T06:46:29.316Z","dependency_job_id":null,"html_url":"https://github.com/RapidAI/RapidOcrNcnn","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidOcrNcnn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidOcrNcnn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidOcrNcnn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RapidAI%2FRapidOcrNcnn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RapidAI","download_url":"https://codeload.github.com/RapidAI/RapidOcrNcnn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284911,"owners_count":20913691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ncnn","ocr"],"created_at":"2024-11-05T12:07:04.300Z","updated_at":"2025-04-05T03:30:29.406Z","avatar_url":"https://github.com/RapidAI.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RapidOcrNcnn\n\n### 联系方式\n\n[QQ群](https://rapidai.github.io/RapidOCRDocs/main/communicate/#qq)\n\n### Project下载\n\n* 整合好源码和依赖库的完整工程项目，可以在Release中下载(github)\n* 可到Q群共享内下载，以Project开头的压缩包文件为源码工程，例：Project_RapidOcrNcnn-版本号.7z\n* 如果想自己折腾，则请继续阅读本说明\n\n### Demo下载(win、mac、linux)\n\n* 编译好的demo，可以在release中下载，或者Q群共享内下载\n* 各平台可执行文件：linux-bin.7z、macos-bin.7z、windows-bin.7z\n* 用于java的jni库：linux-jni.7z、macos-jni.7z、windows-jni.7z\n* 用于C的动态库：linux-clib.7z、macos-clib.7z、windows-clib.7z\n* C动态库调用范例:[RapidOcrNcnnLibTest](https://github.com/RapidAI/RapidOcrNcnnLibTest)\n* 注意：linux编译平台为ubuntu18.04，如果你的linux版本无法运行demo，请自行从源码编译依赖库和完整项目。\n\n### 介绍\n\n请查看项目主仓库：https://github.com/RapidAI/RapidOCR\n\n这个项目使用ncnn框架进行推理\n\n采用ncnn框架[https://github.com/Tencent/ncnn](https://github.com/Tencent/ncnn)\n\n### 更新说明\n\n#### 2022-10-18 update v1.1.0\n\n* opencv 4.6.0\n* ncnn 20220729\n* windows支持mt版引用库\n* rec模型输入图片高度改为48\n* 修复：scoreToTextLine方法索引越界问题\n* Windows控制台编码修改为UTF8\n\n#### 2022-10-20 update v1.1.1\n\n* rec阶段启用gpu\n* 修复空格问题\n* 改进benchmark输出格式\n\n#### 2023-02-14 update v1.2.0\n\n* ncnn: 20221128\n* vulkan: 1.3.236.0\n\n### 模型下载\n\n整合好的范例工程自带了模型，在models文件夹中\n\n```\nRapidOcrNcnn/models\n    ├── ch_PP-OCRv3_det_infer.bin\n    ├── ch_PP-OCRv3_det_infer.param\n    ├── ch_PP-OCRv3_rec_infer.bin\n    ├── ch_PP-OCRv3_rec_infer.param\n    ├── ch_ppocr_mobile_v2.0_cls_infer.bin\n    ├── ch_ppocr_mobile_v2.0_cls_infer.param\n    └── ppocr_keys_v1.txt\n```\n\n### [编译说明](./BUILD.md)\n\n### 测试说明\n\n1. 根据系统下载对应的程序包linux-bin.7z、macos-bin.7z、windows-bin.7z，并解压.\n2. 把上面的模型下载，解压到第一步解压的文件夹里.\n3. 终端运行run-test.sh或命令行运行run-test.bat，查看识别结果.\n4. 终端运行run-benchmark.sh或命令行运行run-benchmark.bat，查看识别过程平均耗时.\n\n### FAQ\n\n#### gpu版程序运行出错，缺少vulkan sdk\n\n参考[编译说明](./BUILD.md) 安装vulkan sdk\n\n#### windows静态链接msvc\n\n- 作用:静态链接CRT(mt)可以让编译出来的包，部署时不需要安装c++运行时，但会增大包体积；\n- 需要mt版的引用库，参考编译说明，下载mt版的库；\n\n#### windows提示缺少\"VCRUNTIME140_1.dll\"\n\n下载安装适用于 Visual Studio 2015、2017 和 2019 的 Microsoft Visual C++ 可再发行软件包\n[下载地址](https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads)\n\n#### Windows7执行错误|中文乱码\n\n1. cmd窗口左上角-属性\n2. 字体选项卡-选择除了“点阵字体”以外的TrueType字体,例如:Lucida Console、宋体\n3. 重新执行bat\n\n### Windows调试运行\n\n* 下载范例项目工程自带的引用库是Release版，不能用于调试运行\n* debug版的引用库未压缩时容量超过1GB，极限压缩后也超过了100MB，请自行编译或到群共享里寻找\n* debug版的引用库必须是md版\n* 把debug版的引用库替换到范例工程的对应文件夹\n* 双击generate-vs-project.bat，选择2)Debug，生成对应的build-win-vsxxx-xx文件夹\n* 进入生成的文件夹，打开RapidOcrOnnx.sln\n* 右边解决方案管理器，选中RapidOcrOnnx，右键-\u003e设为启动项目，并生成(查看输出log，确保生成成功)\n* 如果引用库是dll，需要把对应的dll文件，例onnxruntime.dll复制到build-win-vsxxx-xx文件夹\\Debug，跟上一步生成的RapidOcrOnnx.exe放在一起\n* 右边解决方案管理器，选中RapidOcrOnnx，右键-\u003e属性-\u003e调试-\u003e\n  命令参数-\u003e```--models ../models --det ch_PP-OCRv3_det_infer --cls ch_ppocr_mobile_v2.0_cls_infer --rec ch_PP-OCRv3_rec_infer --keys ppocr_keys_v1.txt --image ../images/1.jpg```\n* 工具栏，点击绿色三角号启动\"本地Windows调试器\"\n* 第一次运行的话，查看左下角，等待加载各dll符号，网络不好的话，要等挺久的\n\n### 输入参数说明\n\n* 请参考main.h中的命令行参数说明。\n* 每个参数有一个短参数名和一个长参数名，用短的或长的均可。\n\n1. ```-d或--models```: 模型所在文件夹路径，可以相对路径也可以绝对路径。\n2. ```-1或--det```: det模型文件名(不含扩展名)\n3. ```-2或--cls```: cls模型文件名(不含扩展名)\n4. ```-3或--rec```: rec模型文件名(不含扩展名)\n5. ```-4或--keys```: keys.txt文件名(含扩展名)\n6. ```-i或--image```: 目标图片路径，可以相对路径也可以绝对路径。\n7. ```-t或--numThread```: 线程数量。\n8. ```-p或--padding```: 图像预处理，在图片外周添加白边，用于提升识别率，文字框没有正确框住所有文字时，增加此值。\n9. ```-s或--maxSideLen```\n   : 按图片最长边的长度，此值为0代表不缩放，例：1024，如果图片长边大于1024则把图像整体缩小到1024再进行图像分割计算，如果图片长边小于1024则不缩放，如果图片长边小于32，则缩放到32。\n10. ```-b或--boxScoreThresh```: 文字框置信度门限，文字框没有正确框住所有文字时，减小此值。\n11. ```-u或--unClipRatio```：单个文字框大小倍率，越大时单个文字框越大。此项与图片的大小相关，越大的图片此值应该越大。\n12. ```-a或--doAngle```：启用(1)/禁用(0) 文字方向检测，只有图片倒置的情况下(旋转90~270度的图片)，才需要启用文字方向检测。\n13. ```-A或--mostAngle```：启用(1)/禁用(0) 角度投票(整张图片以最大可能文字方向来识别)，当禁用文字方向检测时，此项也不起作用。\n14. ```-h或--help```：打印命令行帮助。\n15. ```-G或--GPU```：尝试使用gpu进行计算，-1(使用CPU)/0(使用GPU0)/1(使用GPU1)/...，GPU选择失败时，则使用CPU进行计算。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidai%2Frapidocrncnn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapidai%2Frapidocrncnn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapidai%2Frapidocrncnn/lists"}