diff --git a/assets/ori.png b/assets/ori.png new file mode 100644 index 0000000..b37da52 Binary files /dev/null and b/assets/ori.png differ diff --git a/assets/txt/img_rot180_demo.jpg b/assets/txt/img_rot180_demo.jpg new file mode 100644 index 0000000..f4725b9 Binary files /dev/null and b/assets/txt/img_rot180_demo.jpg differ diff --git a/assets/text.jpg b/assets/txt/text.jpg similarity index 100% rename from assets/text.jpg rename to assets/txt/text.jpg diff --git a/assets/txt/textline_rot180_demo.jpg b/assets/txt/textline_rot180_demo.jpg new file mode 100644 index 0000000..9fc0b79 Binary files /dev/null and b/assets/txt/textline_rot180_demo.jpg differ diff --git a/assets/ch/word_1.jpg b/assets/txt/word_1.jpg similarity index 100% rename from assets/ch/word_1.jpg rename to assets/txt/word_1.jpg diff --git a/assets/ch/word_2.jpg b/assets/txt/word_2.jpg similarity index 100% rename from assets/ch/word_2.jpg rename to assets/txt/word_2.jpg diff --git a/assets/ch/word_3.jpg b/assets/txt/word_3.jpg similarity index 100% rename from assets/ch/word_3.jpg rename to assets/txt/word_3.jpg diff --git a/dnn/DocumentOrientation.simple b/dnn/DocumentOrientation.simple new file mode 100644 index 0000000..0ed58d6 Binary files /dev/null and b/dnn/DocumentOrientation.simple differ diff --git a/dnn/QRCode.simple b/dnn/QRCode.simple index 444deb4..a97b79c 100644 Binary files a/dnn/QRCode.simple and b/dnn/QRCode.simple differ diff --git a/dnn/TextChinese.simple b/dnn/TextChinese.simple index 96070b5..4e0a38f 100644 Binary files a/dnn/TextChinese.simple and b/dnn/TextChinese.simple differ diff --git a/dnn/TextDetection.simple b/dnn/TextDetection.simple index 3340e89..88e5974 100644 Binary files a/dnn/TextDetection.simple and b/dnn/TextDetection.simple differ diff --git a/dnn/TextUnwarping.simple b/dnn/TextUnwarping.simple new file mode 100644 index 0000000..7676770 Binary files /dev/null and b/dnn/TextUnwarping.simple differ diff --git a/dnn/TextlineOrientation.simple b/dnn/TextlineOrientation.simple new file mode 100644 index 0000000..fc0330b Binary files /dev/null and b/dnn/TextlineOrientation.simple differ diff --git a/docx/CHANGELOG.md b/docx/CHANGELOG.md index 737a597..bc29b0d 100644 --- a/docx/CHANGELOG.md +++ b/docx/CHANGELOG.md @@ -1,4 +1,22 @@ -# [0.46.0](https://github.com/shelllet/winui/compare/main...dev) (2025-07-22) +# [0.47.0](https://github.com/shelllet/winui/compare/main...dev) (2025-09-22) + +### Changed: +1. 优化文字识别动作,文字识别结果已经更改为从上至下的顺序。 +2. 支持鼠标右键拖动动作视图。 +3. 修复另存时,项目未进入快速启动列表中。 +4. 关机动作更新为 [SuspendSystem](./actions/system/SuspendSystem.md), 并且支持休眠。 +5. 支持运行当前的工作流。 +6. [退出流程] 动作更名,参考: [退出流程](./actions/control/Exit.md)。 +7. 增加 [域名查询](./actions/control/DomainQuery.md) 动作, 用于操持流程不退出。 + +### Note + +1. 使用管理员权限运行 *小友+*, 无法显示 *动作* 的拖动效果(已知问题)。 +2. 该版本由于内置了一些文字处理相关的模型,安装包大小已经超过 `300M`。 +3. 下载(压缩包,解压覆盖本地文件):https://winui.net/_media/simple/小友+0.47.0.zip +4. 下载(安装包):https://winui.net/_media/simple/小友+0.47.0-setup.x64.exe + +## [0.46.0](https://github.com/shelllet/winui/compare/main...dev) (2025-07-22) ### Changed: 1. [枚举窗口](./actions/window/EnumWindows.md) 动作不再支持异步处理。 @@ -10,7 +28,7 @@ ### Note 1. 使用管理员权限运行 *小友+*, 无法显示 *动作* 的拖动效果(已知问题)。 -3. 64位下载(x64):邀请你加入群组:小友+ http://yun.139.com/m/#/invitation?type=1&msgId=1227933999795726207 +2. 64位下载(x64):https://winui.net/_media/simple/小友+0.46.0-setup.x64.exe ## [0.45.0](https://github.com/shelllet/winui/compare/main...dev) (2025-06-13) @@ -31,8 +49,8 @@ ### Changed: 1. [相机类型](./actions/type/TypeCamera.md) 动作支持工业 USB3/GIGE 接口相机,比如海康相机。 -2. 更新 [文字识别](./actions/ai/PaddleOCR.md) 动作,运行加载其它语言模型,用来识别中英文以外的文字。 -3. 更新 [文字识别(Tesseract)](./actions/ai/TesseractOCR.md) 动作, 支持基于 *Tesseract* (常用来识别特殊字体)的文字识别。 +2. 更新 [文字识别](./actions/ai/TextRecognition.md) 动作,运行加载其它语言模型,用来识别中英文以外的文字。 +3. 更新 [文字识别(Tesseract)](./actions/ai/TextExtract.md) 动作, 支持基于 *Tesseract* (常用来识别特殊字体)的文字识别。 4. 添加动作菜单*缓存对象*。 用来解决 某些动作反复执行时,由于内置对象的初始化比较耗,导致不必要的时间开销。 5. 动作支持借助脚本更新运行时参数,详情参考动作说明。 6. 修复导入其它流程崩溃问题。 diff --git a/docx/_sidebar.md b/docx/_sidebar.md index 715e740..854aa91 100644 --- a/docx/_sidebar.md +++ b/docx/_sidebar.md @@ -15,7 +15,7 @@ - [变量](./introduction/workflow/variable.md) - [资源](./introduction/workflow/resources.md) - [动作](./introduction/workflow/action.md) - - [流程操作技巧](./introduction/workflow/skill.md) + - [内置功能](./introduction/workflow/features.md) - 浏览器 - [Web 定位策略](./introduction/webdriver/locators.md) - [WebDriver 下载](./introduction/webdriver/download.md) @@ -41,7 +41,7 @@ - [打开应用](./actions/system/OpenApplication.md) - [打开文件](./actions/system/LaunchFile.md) - [打开链接](./actions/system/OpenUrl.md) - - [退出系统](./actions/system/ExitWindows.md) + - [退出系统](./actions/system/SuspendSystem.md) - [关闭句柄](./actions/system/CloseHandle.md) - [检测进程](./actions/system/ExistProcess.md) - [终止进程](./actions/system/KillProcess.md) @@ -148,11 +148,14 @@ - 深度学习 - [目标分类](./actions/ai/ImageClassification.md) - [对象检测](./actions/ai/ObjectDetection.md) - - [文字识别](./actions/ai/PaddleOCR.md) - - [文本块检测](./actions/ai/TextDetection.md) + - [文字图像方向矫正](./actions/ai/DocumentOrientation.md) + - [文字图像矫正](./actions/ai/TextUnwarping.md) + - [文字区域检测](./actions/ai/TextDetection.md) + - [文字角度纠正](./actions/ai/TextlineOrientation.md) + - [文字识别](./actions/ai/TextRecognition.md) - [二维码识别](./actions/ai/QRCode.md) - [条码识别](./actions/ai/BarcodeDetector.md) - - [文字识别(Tesseract)](./actions/ai/TesseractOCR.md) + - [文本提取](./actions/ai/TextExtract.md) - 媒体 - [窗口截图](./actions/media/CaptureWindow.md) - [全屏截图](./actions/media/CaptureScreen.md) @@ -171,6 +174,8 @@ - [数据发送](./actions/network/NetworkSend.md) - [数据接收](./actions/network/NetworkReceive.md) - [服务连接](./actions/network/NetworkConnect.md) + - [域名查询](./actions/network/DomainQuery.md) + - 统计分析 - [加载文档](./actions/pandas/LoadDocument.md) - [查询](./actions/pandas/DataFrameQuery.md) @@ -241,7 +246,7 @@ - [调用](./actions/control/Invoke.md) - [停止循环](./actions/control/Break.md) - [脚本](./actions/control/Code.md) - - [退出流程](./actions/control/Quit.md) + - [退出流程](./actions/control/Exit.md) - [表达式](./actions/control/CodeExpression.md) - [引用动作](./actions/control/ActionAlias.md) - [引用动作(名称)](./actions/control/NameAlias.md) @@ -351,7 +356,7 @@ - [FeatureAlgorithm](./enums/FeatureAlgorithm.md) - [WindowSortDirection](./enums/WindowSortDirection.md) - [FileExtension](./enums/FileExtension.md) - - [ExitWindowsOption](./enums/ExitWindowsOption.md) + - [SuspendStateOption](./enums/SuspendStateOption.md) - [WebKey](./enums/WebKey.md) - [WebLocated](./enums/WebLocated.md) - [ModuleOption](./enums/ModuleOption.md) diff --git a/docx/actions/ai/DocumentOrientation.md b/docx/actions/ai/DocumentOrientation.md new file mode 100644 index 0000000..e72337f --- /dev/null +++ b/docx/actions/ai/DocumentOrientation.md @@ -0,0 +1,25 @@ +# 文字图像方向矫正 + +将文档图像的方向区分出来,并使用后处理将其矫正。在诸如文档扫描、证照拍摄等过程中,有时为了拍摄更清晰,会将拍摄设备进行旋转,导致得到的图片也是不同方向的。此时,标准的OCR流程无法很好地应对这些数据。利用图像分类技术,可以预先判断含文字区域的文档或证件的方向,并将其进行方向调整,从而提高 OCR 处理的准确性。 + +![DocumentOrientation](./images/09.png ':size=90%') + +## 子流程 +> 不支持 + +## 运行参数 + +* 图像 1 +> 包含文字的图片。 + + +## 输出 + +> 参考 [Image](./types/Image.md); + +### 其它 + +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple + + + diff --git a/docx/actions/ai/PaddleOCR.md b/docx/actions/ai/PaddleOCR.md deleted file mode 100644 index d90b75b..0000000 --- a/docx/actions/ai/PaddleOCR.md +++ /dev/null @@ -1,40 +0,0 @@ -# 文字识别 -识别图像中的中文/英文文字。 - -![PaddleOCR](./images/03.png ':size=90%') - -## 子流程 -> 不支持 - -## 运行参数 - -* 图像 -> 包含文字的图片。 - -* 文本框评分 -> 计算文本框的得分,分值太低,则不认为是有效的文本框。 - -* 置信度 -> 正确识别文字的得分,分值太低,认为识别不准确,则会忽略该文字的识别。 - -* 角度分类器 -> 指定是否使用角度分类器,默认识别:0°、90° 、270°。 如果使用,则可识别旋转180°的图片。如果文本没有旋转180°,为了性能,请不要使用该选项。其它文本旋转角度无法准确识别。 - -* 检测模型 -> 检测模型文件,用于非内置语言检测。 -* 分类器模型 -> 角度分类模型文件,用于非内置语言检测。 -* 识别模型 -> 识别模型文件,用于非内置语言检测。 -* 字典文件 -> 字典文件,参考:[Paddle2ONNX模型转化与预测](./introduction/mixed/paddle2onnx.md)。 -## 输出 - -> 识别结果, 参考: [`RecognitionResults`](./types/RecognitionResult.md)。 - -### 其它 - -示例 https://github.com/shelllet/WinUi/blob/main/dnn/PaddleOCR.simple - - - diff --git a/docx/actions/ai/TextDetection.md b/docx/actions/ai/TextDetection.md index c191576..5359417 100644 --- a/docx/actions/ai/TextDetection.md +++ b/docx/actions/ai/TextDetection.md @@ -1,36 +1,40 @@ -# 文本块检测 -检测图像上的文本区域。 +# 文字区域检测 +在图像中定位和标记出包含文本的区域。该模块的性能直接影响到整个OCR系统的准确性和效率。 -![TextDetection](./images/04.png ':size=90%') +![TextDetection](./images/03.png ':size=90%') ## 子流程 > 不支持 - ## 运行参数 -* 图像 -> 包含文字的图像 +* 图像 1 +> 包含文字的图片。 -* 文本框评分 -> 计算文本框的得分,分值太低,则不认为是有效的文本框。 +* 图像边长限制类型 2 +> [短边] 表示确保图片最短边不小于 [文本检测的图片边长限制],[长边] 表示确保图片最长边不大于 [文本检测的图片边长限制]。 -## 输出 +* 图片边长限制 3 +> 对于文本密集的大图像,如果想要更准确的识别,应该选择更大的尺寸。此参数与[文本检测的图像边长限制类型]配合使用。通常,[长边]的最大值适用于图像较大且文本密集的场景,[短边]的最小值适用于图像较小且文本密集的文档场景。 -> 检测结果,参考:[DetectionResults](./types/DetectionResult.md)。 -## 脚本调用 +* 文本检测像素阈值 4 +> 在输出概率图中,只有得分大于阈值的像素才被视为文本像素,取值范围为 `0 ~ 1`。 -```python -import simple; +* 文本检测框阈值 5 -``` +> 当检测结果边框内所有像素的平均得分大于阈值时,该结果将被视为文本区域,取值范围为 `0` 至 `1`。如果出现漏检,可以适当降低此值。 + +* 文本检测去裁剪比例 6 +>使用此方法扩展文本区域。值越大,扩展区域越大。 -### 其它 -示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextDetection.simple +## 输出 +> 参考 [`DetectionResults`](./types/DetectionResult.md)。 + +### 其它 +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple -!> 文字检测模型训练:https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_ch/detection.md diff --git a/docx/actions/ai/TesseractOCR.md b/docx/actions/ai/TextExtract.md similarity index 93% rename from docx/actions/ai/TesseractOCR.md rename to docx/actions/ai/TextExtract.md index e96ae6d..0ba8a9f 100644 --- a/docx/actions/ai/TesseractOCR.md +++ b/docx/actions/ai/TextExtract.md @@ -1,11 +1,11 @@ -# 文字识别(Tesseract) +# TextExtract 基于 Tesseract OCR 的一款开源的光学字符识别引擎。能够识别多种语言的文字,包括但不限于英语、中文、法语、德语等。 * 支持多种语言:Tesseract 能够识别多种语言的文字,包括但不限于英语、中文、法语、德语等。通过训练数据的扩展,其语言识别能力还在不断增强。 * 高识别准确率:在经过大量数据训练和优化后,对于清晰的文档图像,Tesseract 可以达到较高的识别准确率。它能够处理多种字体、字号和排版格式的文字,对噪声和图像变形有一定的鲁棒性。 * 可定制性强:用户可以根据自己的需求对 Tesseract 进行定制,例如训练自己的字库模型,以提高对特定领域或特殊字体的识别效果。此外,还可以调*整各种参数来优化识别过程,适应不同的应用场景。 -![TesseractOCR](./images/07.png ':size=90%') +![TextExtract](./images/07.png ':size=90%') ## 子流程 > 不支持 @@ -30,4 +30,4 @@ ### 其它 -示例 https://github.com/shelllet/WinUi/blob/main/dnn/PaddleOCR.simple +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple diff --git a/docx/actions/ai/TextRecognition.md b/docx/actions/ai/TextRecognition.md new file mode 100644 index 0000000..7d435a0 --- /dev/null +++ b/docx/actions/ai/TextRecognition.md @@ -0,0 +1,27 @@ +# 文字识别 +识别图像中的中文/英文文字。 + +![TextRecognition](./images/08.png ':size=90%') + +## 子流程 +> 不支持 + +## 运行参数 + +* 图像 1 +> 包含文字的图片。 + +* 置信度 2/sup> +> 文本检测完成后,对文本框内的文字进行文本识别,得分大于该阈值的文本结果将被保留。取值范围为 `0 ~ 1`。 + + +## 输出 + +> 参考 [`RecognitionResults`](./types/RecognitionResult.md)。 + +### 其它 + +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple + + + diff --git a/docx/actions/ai/TextUnwarping.md b/docx/actions/ai/TextUnwarping.md new file mode 100644 index 0000000..c6678ad --- /dev/null +++ b/docx/actions/ai/TextUnwarping.md @@ -0,0 +1,24 @@ +# 文字图像矫正 +针对图像进行几何变换,以纠正图像中的文档扭曲、倾斜、透视变形等问题,以供后续的文本识别进行更加准确。 + +![TextUnwarping](./images/11.png ':size=90%') + +## 子流程 +> 不支持 + +## 运行参数 + +* 图像 1 +> 包含文字的图片。 + + +## 输出 + +> 参考 [Image](./types/Image.md)。 + +### 其它 + +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple + + + diff --git a/docx/actions/ai/TextlineOrientation.md b/docx/actions/ai/TextlineOrientation.md new file mode 100644 index 0000000..f13de05 --- /dev/null +++ b/docx/actions/ai/TextlineOrientation.md @@ -0,0 +1,23 @@ +# 文字角度纠正 +角度分类器,默认识别:0°、90° 、270°。 如果使用,则可识别旋转180°的图片。如果文本没有旋转180°,为了性能,请不要使用该选项。其它文本旋转角度无法准确识别。 + +![TextlineOrientation](./images/10.png ':size=90%') + +## 子流程 +> 不支持 + +## 运行参数 + +* 图像 1 +> 包含文字的图片,也可以是 [TextDetection](./actions/ai/TextDetection.md) 的结果 。 + +## 输出 + +> 如果参数 `1` 是图像, 参考 [Image](./types/Image.md);如果参数 `1` 是 [`DetectionResults`](./types/DetectionResult.md), 参考 [DetectionResults](./types/DetectionResult.md)。 + +### 其它 + +示例 https://github.com/shelllet/WinUi/blob/main/dnn/TextRecognition.simple + + + diff --git a/docx/actions/ai/images/03.png b/docx/actions/ai/images/03.png index e146cd3..5622e4f 100644 Binary files a/docx/actions/ai/images/03.png and b/docx/actions/ai/images/03.png differ diff --git a/docx/actions/ai/images/08.png b/docx/actions/ai/images/08.png new file mode 100644 index 0000000..041f563 Binary files /dev/null and b/docx/actions/ai/images/08.png differ diff --git a/docx/actions/ai/images/09.png b/docx/actions/ai/images/09.png new file mode 100644 index 0000000..83cf06f Binary files /dev/null and b/docx/actions/ai/images/09.png differ diff --git a/docx/actions/ai/images/10.png b/docx/actions/ai/images/10.png new file mode 100644 index 0000000..e7d1e8b Binary files /dev/null and b/docx/actions/ai/images/10.png differ diff --git a/docx/actions/ai/images/11.png b/docx/actions/ai/images/11.png new file mode 100644 index 0000000..820cd7d Binary files /dev/null and b/docx/actions/ai/images/11.png differ diff --git a/docx/actions/algorithm/FilterText.md b/docx/actions/algorithm/FilterText.md index ee28f6f..481865e 100644 --- a/docx/actions/algorithm/FilterText.md +++ b/docx/actions/algorithm/FilterText.md @@ -10,7 +10,7 @@ ## 运行参数 * 数据 -> 含有文本的列表,例如 [*文字识别*](./actions/ai/PaddleOCR.md) 动作。 +> 含有文本的列表,例如 [*文字识别*](./actions/ai/TextRecognition.md) 动作。 * 文本 > 文本,*字符串* 类型,参考:[String](./types/String.md), 支持 [*通配符(WildCard)*](./introduction/process/wildcard.md) 匹配。 diff --git a/docx/actions/algorithm/JoinString.md b/docx/actions/algorithm/JoinString.md index 59fcc5d..2d94f58 100644 --- a/docx/actions/algorithm/JoinString.md +++ b/docx/actions/algorithm/JoinString.md @@ -1,5 +1,5 @@ # 合并字符串 -将字符串列表,或者含有字符串的列表(如 [文本检测](./actions/ai/PaddleOCR.md)),合并成字符串。 +将字符串列表,或者含有字符串的列表(如 [文本检测](./actions/ai/TextRecognition.md)),合并成字符串。 ![JoinString](./images/16.png ':size=90%') diff --git a/docx/actions/control/Quit.md b/docx/actions/control/Exit.md similarity index 100% rename from docx/actions/control/Quit.md rename to docx/actions/control/Exit.md diff --git a/docx/actions/network/DomainQuery.md b/docx/actions/network/DomainQuery.md new file mode 100644 index 0000000..2c614d0 --- /dev/null +++ b/docx/actions/network/DomainQuery.md @@ -0,0 +1,29 @@ +# 域名查询 +域名解析是将域名(例如 www.google.com)转换成 IP 地址(例如 142.251.42.206)的过程,它是互联网运作的基石之一。当你在浏览器中输入一个域名时,幕后会发生一系列复杂的步骤来找到对应的服务器 IP 地址。 + +![DomainQuery](./images/10.png ':size=90%') + +## 子流程 + +> 不支持 + +## 运行参数 + + +* 域名 +> 要解析的主机名或 IP 地址字符串(如 `www.example.com` 或 `192.168.1.1`)。 + +* 服务 + +> 可选参数,通常是端口号或服务名称(如 `80` 或 `http`)。如果只需要解析 IP 地址,可以设置为 NULL。 + +## 输出 + +> IP 地址列表,参考[Strings](./types/String.md)。 + +## 其它 + + + + + diff --git a/docx/actions/network/images/10.png b/docx/actions/network/images/10.png new file mode 100644 index 0000000..443449f Binary files /dev/null and b/docx/actions/network/images/10.png differ diff --git a/docx/actions/system/ExitWindows.md b/docx/actions/system/ExitWindows.md deleted file mode 100644 index c4485e1..0000000 --- a/docx/actions/system/ExitWindows.md +++ /dev/null @@ -1,30 +0,0 @@ -# 退出系统 -关闭操作系统,或者注销当前交互的用户,或者重启操作系统。 - -![ExitWindows](./images/09.png ':size=90%') - -## 权限 -> 无要求 - -## 子流程 - -> 不支持 - -## 运行参数 - -* 类型 -> 注销,关机或者重启,参考:[ExitWindowsOption](./enums/ExitWindowsOption.md) - -## 输出 - -> 无 - - -## 资源 - -* 示例流程:https://github.com/shelllet/WinUi/blob/main/system/ExitWindows.simple - - - - - diff --git a/docx/actions/system/SuspendSystem.md b/docx/actions/system/SuspendSystem.md new file mode 100644 index 0000000..db1a6c1 --- /dev/null +++ b/docx/actions/system/SuspendSystem.md @@ -0,0 +1,30 @@ +# 暂停系统 +注销、关闭、休眠或者重启当前的操作系统。 + +![SuspendSystem](./images/09.png ':size=90%') + +## 权限 +> 无要求 + +## 子流程 + +> 不支持 + +## 运行参数 + +* 类型 +> 注销、关机、休眠或者重启,参考:[SuspendStateOption](./enums/SuspendStateOption.md) + +## 输出 + +> 无 + + +## 资源 + +* 示例流程:https://github.com/shelllet/WinUi/blob/main/system/SuspendSystem.simple + + + + + diff --git a/docx/enums/ExitWindowsOption.md b/docx/enums/ExitWindowsOption.md deleted file mode 100644 index 3ca2f02..0000000 --- a/docx/enums/ExitWindowsOption.md +++ /dev/null @@ -1,8 +0,0 @@ -# ExitWindowsOption - -* LOGOFF -> 注销。 -* REBOOT -> 重启。 -* SHUTDOWN -> 关机。 diff --git a/docx/enums/SuspendStateOption.md b/docx/enums/SuspendStateOption.md new file mode 100644 index 0000000..27854b9 --- /dev/null +++ b/docx/enums/SuspendStateOption.md @@ -0,0 +1,10 @@ +# SuspendStateOption + +* Logoff +> 注销。 +* Reboot +> 重启。 +* Shutdown +> 关机。 +* Hibernate +> 休眠 diff --git a/docx/index.html b/docx/index.html index fcf8cf6..b902048 100644 --- a/docx/index.html +++ b/docx/index.html @@ -8,10 +8,11 @@ - + - + + @@ -74,6 +75,7 @@ + \ No newline at end of file diff --git a/docx/introduction/mixed/paddle2onnx.md b/docx/introduction/mixed/paddle2onnx.md index 9cfe277..62546cc 100644 --- a/docx/introduction/mixed/paddle2onnx.md +++ b/docx/introduction/mixed/paddle2onnx.md @@ -77,7 +77,7 @@ deactivate ``` ### Paddle -在使用 `pip install paddle` 安装 PaddlePaddle(以下简称 Paddle)时,有一些要点需要注意,下面为你详细介绍不同环境下的安装步骤和注意事项。 +在使用 `pip install paddlepaddle` 安装 PaddlePaddle(以下简称 Paddle)时,有一些要点需要注意,下面为你详细介绍不同环境下的安装步骤和注意事项。 #### 1. 选择合适的 Paddle 版本 @@ -129,7 +129,7 @@ $env:PATH = "D:\onnx\cudnn-windows-x86_64-8.9.7.29_cuda12-archive\bin;$env:PATH; 然后根据版本选择合适的安装命令。例如,如果你使用的是 CUDA 12.0 和 cuDNN 9.8,可以运行以下命令: ```bash -pip install paddlepaddle-gpu==2.6.1.post120 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html +pip install paddlepaddle-gpu==3.1.0.post120 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html ``` 其中 `2.6.1.post120` 表示 Paddle 的版本,`120` 代表 CUDA 12.0。你可以根据自己的实际情况调整版本号。 @@ -166,7 +166,7 @@ Paddle2ONNX 支持将 PaddlePaddle 模型格式转化到 ONNX 模型格式,算 使用虚拟环境:```(myenv) PS D:\onnx>```。 - 安装 Paddle2ONNX ``` -python -m pip install paddle2onnx +python -m pip install paddle2onnx==2.0.2rc3 ``` - 安装 ONNXRuntime @@ -179,58 +179,251 @@ python -m pip install onnxruntime - Paddle 模型下载 -在 [模型列表](https://paddlepaddle.github.io/PaddleOCR/latest/model/index.html) 中下载PaddleOCR提供的预测模型。通常包含3种模型,其中 **方向分类器** 更新较慢,如果版本号琶可直接使用。 - - -以 PP-OCRv4 中文检测、识别、分类模型为例: +在 [模型列表](https://www.paddleocr.ai/latest/version3.x/pipeline_usage/OCR.html) 中下载PaddleOCR提供的预测模型。目前包含 5 种模型, + + +
+文档图像方向分类模块(可选): + + + + + + + + + + + + + + + + + + + + + + +
模型模型下载链接Top-1 Acc(%)GPU推理耗时(ms)
[常规模式 / 高性能模式]
CPU推理耗时(ms)
[常规模式 / 高性能模式]
模型存储大小(MB)介绍
PP-LCNet_x1_0_doc_ori推理模型/训练模型99.062.62 / 0.593.24 / 1.197基于PP-LCNet_x1_0的文档图像分类模型,含有四个类别,即0度,90度,180度,270度
+
+ +
+文本图像矫正模块(可选): + + + + + + + + + + + + + + + + + + + + + + +
模型模型下载链接CER GPU推理耗时(ms)
[常规模式 / 高性能模式]
CPU推理耗时(ms)
[常规模式 / 高性能模式]
模型存储大小(MB)介绍
UVDoc推理模型/训练模型0.17919.05 / 19.05- / 869.8230.3高精度文本图像矫正模型
+
+ +
+文本行方向分类模块(可选): + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
模型模型下载链接Top-1 Acc(%)GPU推理耗时(ms)CPU推理耗时 (ms)模型存储大小(MB)介绍
PP-LCNet_x0_25_textline_ori推理模型/训练模型98.852.16 / 0.412.37 / 0.730.96基于PP-LCNet_x0_25的文本行分类模型,含有两个类别,即0度,180度
PP-LCNet_x1_0_textline_ori推理模型/训练模型99.42- / -2.98 / 2.986.5基于PP-LCNet_x1_0的文本行分类模型,含有两个类别,即0度,180度
+
+ +
+文本检测模块: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
模型模型下载链接检测Hmean(%)GPU推理耗时(ms)
[常规模式 / 高性能模式]
CPU推理耗时(ms)
[常规模式 / 高性能模式]
模型存储大小(MB)介绍
PP-OCRv5_server_det推理模型/训练模型83.889.55 / 70.19383.15 / 383.1584.3PP-OCRv5 的服务端文本检测模型,精度更高,适合在性能较好的服务器上部署
PP-OCRv5_mobile_det推理模型/训练模型79.010.67 / 6.3657.77 / 28.154.7PP-OCRv5 的移动端文本检测模型,效率更高,适合在端侧设备部署
+
+ +
+文本识别模块: + + + + + + + + + + + + + + + + + + + + + + + + + + +
模型模型下载链接识别 Avg Accuracy(%)GPU推理耗时(ms)
[常规模式 / 高性能模式]
CPU推理耗时(ms)
[常规模式 / 高性能模式]
模型存储大小(MB)介绍
PP-OCRv5_server_rec推理模型/训练模型86.388.46 / 2.3631.21 / 31.2181PP-OCRv5_rec 是新一代文本识别模型。该模型致力于以单一模型高效、精准地支持简体中文、繁体中文、英文、日文四种主要语言,以及手写、竖版、拼音、生僻字等复杂文本场景的识别。在保持识别效果的同时,兼顾推理速度和模型鲁棒性,为各种场景下的文档理解提供高效、精准的技术支撑。
PP-OCRv5_mobile_rec推理模型/训练模型81.295.43 / 1.4621.20 / 5.3216
+ +
+ +**小友+** 中集成了 `v5` 版本的 `Mobile` 模型,如果您更注重模型的精度,请选择精度较高的模型。 + +* 文档图像方向分类模块( a.oonx) +* 文本图像矫正模块 b.onnx +* 文本行方向分类模块 c.onnx +* 文本检测模块> d.onxx +* 文本识别模块> e.onnx ``` -# 检测模型 -wget -O ./ch_PP-OCRv4_det_infer.tar https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar -# 方向分类器 -wget -O ./ch_ppocr_mobile_v2.0_cls_infer.tar https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar +tar xf PP-LCNet_x1_0_doc_ori_infer.tar -# 识别模型 -wget -O ./ch_PP-OCRv4_rec_infer.tar https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_rec_infer.tar +tar xf UVDoc_infer.tar -tar xf ch_PP-OCRv4_det_infer.tar +tar xf PP-OCRv5_mobile_det_infer.tar -tar xf ch_ppocr_mobile_v2.0_cls_infer.tar +tar xf PP-LCNet_x1_0_textline_ori_infer.tar -tar xf ch_PP-OCRv4_rec_infer.tar +tar xf PP-OCRv5_mobile_rec_infer ``` -- 模型转换(包含3种基础模型) - 使用 Paddle2ONNX 将Paddle静态图模型转换为ONNX模型格式: ```PowerShell -paddle2onnx --model_dir ./ch_PP-OCRv4_det_infer ` ---model_filename inference.pdmodel ` +cd PP-LCNet_x1_0_doc_ori_infer + +paddle2onnx --model_dir . ` +--model_filename inference.json ` +--params_filename inference.pdiparams ` +--save_file ./model.onnx ` +--opset_version 18 ` +--enable_onnx_checker True ` +--optimize_tool polygraphy + + +cd UVDoc_infer + +paddle2onnx --model_dir . ` +--model_filename inference.json ` --params_filename inference.pdiparams ` ---save_file ./det_model.onnx ` ---opset_version 14 ` ---enable_onnx_checker True +--save_file ./model.onnx ` +--opset_version 18 ` +--enable_auto_update_opset True ` +--enable_onnx_checker True ` +--optimize_tool polygraphy + +cd PP-OCRv5_mobile_det_infer -paddle2onnx --model_dir ./ch_PP-OCRv4_rec_infer ` ---model_filename inference.pdmodel ` +paddle2onnx --model_dir . ` +--model_filename inference.json ` --params_filename inference.pdiparams ` ---save_file ./rec_model.onnx ` ---opset_version 14 ` ---enable_onnx_checker True +--save_file ./model.onnx ` +--opset_version 18 ` +--enable_onnx_checker True ` +--optimize_tool polygraphy + + -paddle2onnx --model_dir ./ch_ppocr_mobile_v2.0_cls_infer ` ---model_filename inference.pdmodel ` +cd PP-LCNet_x1_0_textline_ori_infer + +paddle2onnx --model_dir . ` +--model_filename inference.json ` --params_filename inference.pdiparams ` ---save_file ./cls_model.onnx ` ---opset_version 14 ` ---enable_onnx_checker True -``` +--save_file ./model.onnx ` +--opset_version 18 ` +--enable_onnx_checker True ` +--optimize_tool onnxoptimizer + -执行完毕后,ONNX 模型会被分别保存为 `./det_model.onnx`,`./rec_model.onnx`,`./cls_model.onnx/` +cd PP-OCRv5_mobile_rec_infer + +paddle2onnx --model_dir . ` +--model_filename inference.json ` +--params_filename inference.pdiparams ` +--save_file ./model.onnx ` +--opset_version 18 ` +--enable_onnx_checker True ` +--optimize_tool onnxoptimizer +``` * 注意:对于OCR模型,转化过程中必须采用动态shape的形式,否则预测结果可能与直接使用Paddle预测有细微不同。 另外,以下几个模型暂不支持转换为 ONNX 模型: @@ -244,6 +437,17 @@ paddle2onnx --model_dir ./ch_ppocr_mobile_v2.0_cls_infer ` --input_shape_dict "{'x': [-1,3,-1,-1]}" ``` +- 优化ONNX + +如你对导出的 ONNX 模型有优化的需求,推荐使用 onnxslim 对模型进行优化: + +``` +pip install onnxslim + +onnxslim input.onnx model.onnx + +``` + ## 3. 推理预测 需要先安装 opencv、shapely、pyclipper等依赖包, 以中文OCR模型为例,使用 ONNXRuntime 预测可执行如下命令: @@ -259,9 +463,9 @@ pip install lmdb ``` cd PaddleOCR python ./tools/infer/predict_system.py --use_gpu=False --use_onnx=True ` ---det_model_dir=../model/det_model.onnx ` ---rec_model_dir=../model/rec_model.onnx ` ---cls_model_dir=../model/cls_model.onnx ` +--det_model_dir=../model/c.onnx ` +--rec_model_dir=../model/e.onnx ` +--cls_model_dir=../model/d.onnx ` --image_dir=./deploy/lite/imgs/lite_demo.png ``` @@ -272,8 +476,8 @@ cd PaddleOCR python ./tools/infer/predict_system.py --use_gpu=False ` --rec_image_shape=3,48,320 ` --cls_model_dir=../model/ch_ppocr_mobile_v2.0_cls_infer ` ---rec_model_dir=../model/ch_PP-OCRv4_rec_infer ` ---det_model_dir=../model/ch_PP-OCRv4_det_infer ` +--rec_model_dir=../model/ch_PP-OCRv5_rec_infer ` +--det_model_dir=../model/ch_PP-OCRv5_det_infer ` --image_dir=./deploy/lite/imgs/lite_demo.png ``` @@ -291,3 +495,15 @@ Paddle Inference 执行效果:
+ +### Q1: 小友+ ONXX 模型支持的 最大 IR VERSION ? +- IR VERSION = 9 + +### Q2: 转换后的模型,ONNX Runtime加载提示`Unknown model file format version`? +- Paddle2ONNX使用了最新的ONNX协议,导出的模型在使用低版本ONNX Runtime加载时,会出现此问题,可通过如下代码修改模型IR VERSION解决,重新加载新保存的`new_model.onnx`即可。 +``` +import onnx +model = onnx.load("model.onnx") +model.ir_version = 9 +onnx.save(model, "new_model.onnx") +``` \ No newline at end of file diff --git a/docx/introduction/workflow/skill.md b/docx/introduction/workflow/features.md similarity index 52% rename from docx/introduction/workflow/skill.md rename to docx/introduction/workflow/features.md index faaceb7..7296639 100644 --- a/docx/introduction/workflow/skill.md +++ b/docx/introduction/workflow/features.md @@ -12,14 +12,20 @@ ![image](./images/07.png ':size=90%') +3 动作视图 + + 按下鼠标右键可拖动视图位置。 + 3. 支持的快捷键 - `Alt + Del` 删除出口连接线 + Alt + Del 删除出口连接线 + + Ctrl + C 复制动作 - `Ctrl + C` 复制动作 + Ctrl + V 粘贴动作 - `Ctrl + V`粘贴动作 + Delete 删除动作 - `Delete` 删除动作 + Esc 关闭打开的窗口 - `Esc` 关闭打开的窗口 \ No newline at end of file + Space 恢复动作视图 \ No newline at end of file diff --git a/docx/introduction/workflow/logic.md b/docx/introduction/workflow/logic.md index 4587540..c6991c4 100644 --- a/docx/introduction/workflow/logic.md +++ b/docx/introduction/workflow/logic.md @@ -20,9 +20,11 @@ * 每个动作的运行时参数基本上都支持 *Python* 表达式或者选择已有的前置动作。 -* 每个流程从*Start* 动作开始执行。 +* 单个流程,都是从*Start* 动作开始执行。 -* 流程动作执行完毕,默认不退出,如果需要退出流程,需要添加 [退出流程](./actions/control/Quit.md) 动作。 +* 流程中所有连接的动作执行完毕后,流程默认不退出,主要是为了处理康诸如 **鼠标键盘监听 **、**线程** 之类的异步动作。 + +* 项目中单个流程可以单独运行,并且最后一个动作执行完毕后退出流程。 ## 动作作用域 动作的作用域通常包括动作本身、兄弟动作所在的流程范围及子动作所在的流程范围,但不包括父动作所在的流程。 \ No newline at end of file diff --git a/docx/network/openwrt_dns.md b/docx/network/openwrt_dns.md new file mode 100644 index 0000000..93717d6 --- /dev/null +++ b/docx/network/openwrt_dns.md @@ -0,0 +1,33 @@ +在 OpenWrt 中设置 DNS 有两种主要方法,具体取决于您想要达到的目的。 + +### 方法一:更改 OpenWrt 路由器本身的 DNS 服务器 + +这种方法让 OpenWrt 路由器作为 DNS 代理服务器,将您网络中所有设备的 DNS 请求转发到您指定的外部 DNS 服务器。这是最常见、最简单的设置方式。 + +1. 登录 OpenWrt 的 LuCI Web 界面(通常是 `http://192.168.1.1`)。 +2. 导航到 **网络 (Network)** -> **接口 (Interfaces)**。 +3. 找到并编辑您的 **WAN** 接口(通常是连接到互联网的接口)。 +4. 在 **高级设置 (Advanced Settings)** 选项卡下,取消勾选 **“使用路由器提供的 DNS 服务器 (Use DNS servers advertised by peer)”**。 +5. 在下方出现的 **“使用自定义 DNS 服务器 (Use custom DNS servers)”** 框中,输入您想要使用的 DNS 服务器 IP 地址,例如 Cloudflare 的 `1.1.1.1` 或 Google 的 `8.8.8.8`。您可以添加多个以空格分隔。 +6. 点击 **保存 (Save)** 并 **应用 (Apply)**。 + +--- + +### 方法二:让客户端直接使用自定义 DNS 服务器 + +这种方法可以让 OpenWrt 的 DHCP 服务器告诉您网络中的设备(如电脑、手机)直接使用您指定的 DNS 服务器,而不是路由器本身。这适用于您希望某些设备绕过路由器的 DNS 代理功能,或使用特定 DNS 功能(如广告拦截或内容过滤)。 + +1. 登录 OpenWrt 的 LuCI Web 界面。 +2. 导航到 **网络 (Network)** -> **DHCP/DNS**。 +3. 在 **DHCP** 选项卡下的 **“高级设置 (Advanced Settings)”** 中,找到 **“DHCP 选项 (DHCP-Options)”** 字段。 +4. 在其中输入 `6,DNS1,DNS2` 的格式。例如,如果您想使用 Cloudflare 的 DNS,可以输入 `6,1.1.1.1,1.0.0.1`。 +5. 点击 **保存 (Save)** 并 **应用 (Apply)**。 + +#### 两种方法的区别 + +* **方法一 (WAN)**:路由器自己使用指定的 DNS,而您的设备仍然会从路由器获得 DNS 地址(通常是 `192.168.1.1`)。然后,路由器会将您的设备的 DNS 请求转发到您在 WAN 接口上设置的 DNS 服务器。这种方法可以方便地实现全网广告拦截或内容过滤。 +* **方法二 (DHCP)**:路由器直接将指定的 DNS 服务器地址推送给网络中的所有设备。设备会直接向该 DNS 服务器发送请求,而不会经过路由器。 + +通常,**方法一**是大多数用户的首选,因为它更简单,并且可以更好地利用 OpenWrt 的其他功能(如广告拦截)。 + +如果您有更复杂的 DNS 需求,比如需要配置 **DNS over HTTPS (DoH)** 或 **DNS over TLS (DoT)** 以加密您的 DNS 查询,则需要安装额外的软件包(如 `https-dns-proxy`)并进行更高级的配置。 \ No newline at end of file diff --git a/network/DomainQuery.simple b/network/DomainQuery.simple new file mode 100644 index 0000000..1cc2374 Binary files /dev/null and b/network/DomainQuery.simple differ