This commit is contained in:
Sunflower7788 2025-05-20 18:34:26 +08:00 committed by GitHub
parent 739d225340
commit d637ba29c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 36 deletions

View File

@ -365,57 +365,57 @@ Relevant methods, parameters, and explanations are as follows:
</tr>
<tr>
<td><code>img_size</code></td>
<td>Size of the input image; if not specified, the default PaddleX official model configuration will be used</td>
<td>Size of the input image; if not specified, the default 800x800 be used</td>
<td><code>int/list/None</code></td>
<td>
<ul>
<li><b>int</b>, e.g., 640, means resizing the input image to 640x640</li>
<li><b>List</b>, e.g., [640, 512], means resizing the input image to a width of 640 and a height of 512</li>
<li><b>None</b>, not specified, will use the default PaddleX official model configuration</li>
<li><b>None</b>, not specified, will use the default 0.5</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>threshold</code></td>
<td>Threshold for filtering low-confidence prediction results; if not specified, the default PaddleX official model configuration will be used</td>
<td>Threshold for filtering low-confidence prediction results; if not specified, the default 0.5 will be used</td>
<td><code>float/dict/None</code></td>
<td>
<ul>
<li><b>float</b>, e.g., 0.2, means filtering out all bounding boxes with a confidence score less than 0.2</li>
<li><b>Dictionary</b>, with keys as <b>int</b> representing <code>cls_id</code> and values as <b>float</b> thresholds. For example, <code>{0: 0.45, 2: 0.48, 7: 0.4}</code> means applying a threshold of 0.45 for cls_id 0, 0.48 for cls_id 2, and 0.4 for cls_id 7</li>
<li><b>None</b>, not specified, will use the default PaddleX official model configuration</li>
<li><b>None</b>, not specified, will use the default 0.5</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_nms</code></td>
<td>Whether to use NMS post-processing to filter overlapping boxes; if not specified, the default PaddleX official model configuration will be used</td>
<td>Whether to use NMS post-processing to filter overlapping boxes; if not specified, the default False will be used</td>
<td><code>bool/None</code></td>
<td>
<ul>
<li><b>bool</b>, True/False, indicates whether to use NMS for post-processing to filter overlapping boxes</li>
<li><b>None</b>, not specified, will use the default PaddleX official model configuration</li>
<li><b>None</b>, not specified, will use the default False</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_unclip_ratio</code></td>
<td>Scaling factor for the side length of the detection box; if not specified, the default PaddleX official model configuration will be used</td>
<td>Scaling factor for the side length of the detection box; if not specified, the default 1.0 will be used</td>
<td><code>float/list/dict/None</code></td>
<td>
<ul>
<li><b>float</b>, a positive float number, e.g., 1.1, means expanding the width and height of the detection box by 1.1 times while keeping the center unchanged</li>
<li><b>List</b>, e.g., [1.2, 1.5], means expanding the width by 1.2 times and the height by 1.5 times while keeping the center unchanged</li>
<li><b>dict</b>, keys as <b>int</b> representing <code>cls_id</code>, values as float scaling factors, e.g., <code>{0: (1.1, 2.0)}</code> means cls_id 0 expanding the width by 1.1 times and the height by 2.0 times while keeping the center unchanged</li>
<li><b>None</b>, not specified, will use the default PaddleX official model configuration</li>
<li><b>None</b>, not specified, will use the default 1.0</li>
</ul>
</td>
<tr>
<td><code>layout_merge_bboxes_mode</code></td>
<td>Merging mode for the detection boxes output by the model; if not specified, the default PaddleX official model configuration will be used</td>
<td>Merging mode for the detection boxes output by the model; if not specified, the default union will be used</td>
<td><code>string/dict/None</code></td>
<td>
<ul>
@ -423,7 +423,7 @@ Relevant methods, parameters, and explanations are as follows:
<li><b>small</b>, when set to small, only the smallest internal box will be retained for overlapping detection boxes, and the external overlapping boxes will be deleted</li>
<li><b>union</b>, no filtering of boxes will be performed, and both internal and external boxes will be retained</li>
<li><b>dict</b>, keys as <b>int</b> representing <code>cls_id</code> and values as merging modes, e.g., <code>{0: "large", 2: "small"}</li>
<li><b>None</b>, not specified, will use the default PaddleX official model configuration</li>
<li><b>None</b>, not specified, will use the default union</li>
</ul>
</td>
<td>None</td>
@ -444,7 +444,6 @@ Relevant methods, parameters, and explanations are as follows:
</tr>
</table>
* Note that `model_name` must be specified. After specifying `model_name`, the default PaddleX built-in model parameters will be used. If `model_dir` is specified, the user-defined model will be used.
* The `predict()` method of the target detection model is called for inference prediction. The parameters of the `predict()` method are `input`, `batch_size`, and `threshold`, which are explained as follows:
@ -488,37 +487,37 @@ Relevant methods, parameters, and explanations are as follows:
<ul>
<li><b>float</b>, e.g., 0.2, means filtering out all bounding boxes with a confidence score less than 0.2</li>
<li><b>Dictionary</b>, with keys as <b>int</b> representing <code>cls_id</code> and values as <b>float</b> thresholds. For example, <code>{0: 0.45, 2: 0.48, 7: 0.4}</code> means applying a threshold of 0.45 for cls_id 0, 0.48 for cls_id 2, and 0.4 for cls_id 7</li>
<li><b>None</b>, not specified, will use the <code>threshold</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default PaddleX official model configuration will be used</li>
<li><b>None</b>, not specified, will use the <code>threshold</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default 0.5 will be used</li>
</ul>
</td>
</tr>
<tr>
<td><code>layout_nms</code></td>
<td>Whether to use NMS post-processing to filter overlapping boxes; if not specified, the default PaddleX official model configuration will be used</td>
<td>Whether to use NMS post-processing to filter overlapping boxes; if not specified, the default False will be used</td>
<td><code>bool/None</code></td>
<td>
<ul>
<li><b>bool</b>, True/False, indicates whether to use NMS for post-processing to filter overlapping boxes</li>
<li><b>None</b>, not specified, will use the <code>layout_nms</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default PaddleX official model configuration will be used</li>
<li><b>None</b>, not specified, will use the <code>layout_nms</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default False will be used</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_unclip_ratio</code></td>
<td>Scaling factor for the side length of the detection box; if not specified, the default PaddleX official model configuration will be used</td>
<td>Scaling factor for the side length of the detection box; if not specified, the default 1.0 will be used</td>
<td><code>float/list/dict/None</code></td>
<td>
<ul>
<li><b>float</b>, a positive float number, e.g., 1.1, means expanding the width and height of the detection box by 1.1 times while keeping the center unchanged</li>
<li><b>List</b>, e.g., [1.2, 1.5], means expanding the width by 1.2 times and the height by 1.5 times while keeping the center unchanged</li>
<li><b>dict</b>, keys as <b>int</b> representing <code>cls_id</code>, values as float scaling factors, e.g., <code>{0: (1.1, 2.0)}</code> means cls_id 0 expanding the width by 1.1 times and the height by 2.0 times while keeping the center unchanged</li>
<li><b>None</b>, not specified, will use the <code>layout_unclip_ratio</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default PaddleX official model configuration will be used</li>
<li><b>None</b>, not specified, will use the <code>layout_unclip_ratio</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default 1.0 will be used</li>
</ul>
</td>
<tr>
<td><code>layout_merge_bboxes_mode</code></td>
<td>Merging mode for the detection boxes output by the model; if not specified, the default PaddleX official model configuration will be used</td>
<td>Merging mode for the detection boxes output by the model; if not specified, the default union will be used</td>
<td><code>string/dict/None</code></td>
<td>
<ul>
@ -526,7 +525,7 @@ Relevant methods, parameters, and explanations are as follows:
<li><b>small</b>, when set to small, only the smallest internal box will be retained for overlapping detection boxes, and the external overlapping boxes will be deleted</li>
<li><b>union</b>, no filtering of boxes will be performed, and both internal and external boxes will be retained</li>
<li><b>dict</b>, keys as <b>int</b> representing <code>cls_id</code> and values as merging modes, e.g., <code>{0: "large", 2: "small"}</li>
<li><b>None</b>, not specified, will use the <code>layout_merge_bboxes_mode</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default PaddleX official model configuration will be used</li>
<li><b>None</b>, not specified, will use the <code>layout_merge_bboxes_mode</code> parameter specified in <code>create_model</code>. If not specified in <code>create_model</code>, the default union will be used</li>
</ul>
</td>
<td>None</td>

View File

@ -367,57 +367,57 @@ for res in output:
</tr>
<tr>
<td><code>img_size</code></td>
<td>输入图像大小;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>输入图像大小;如果不指定,PP-DocLayout_plus-L模型将默认使用800x800</td>
<td><code>int/list/None</code></td>
<td>
<ul>
<li><b>int</b>, 如 640 , 表示将输入图像resize到640x640大小</li>
<li><b>列表</b>, 如 [640, 512] , 表示将输入图像resize到宽为640高为512大小</li>
<li><b>None</b>, 不指定,将默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,PP-DocLayout_plus-L模型将默认使用800x800</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>threshold</code></td>
<td>用于过滤掉低置信度预测结果的阈值;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>用于过滤掉低置信度预测结果的阈值;如果不指定,将默认使用0.5</td>
<td><code>float/dict/None</code></td>
<td>
<ul>
<li><b>float</b>,如 0.2 表示过滤掉所有阈值小于0.2的目标框</li>
<li><b>字典</b>字典的key为<b>int</b>类型,代表<code>cls_id</code>val为<b>float</b>类型阈值。如 <code>{0: 0.45, 2: 0.48, 7: 0.4}</code>表示对cls_id为0的类别应用阈值0.45、cls_id为1的类别应用阈值0.48、cls_id为7的类别应用阈值0.4</li>
<li><b>None</b>, 不指定,将默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用0.5</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_nms</code></td>
<td>是否使用NMS后处理过滤重叠框如果不指定将默认使用PaddleX官方模型配置</td>
<td>是否使用NMS后处理过滤重叠框如果不指定将默认不使用NMS</td>
<td><code>bool/None</code></td>
<td>
<ul>
<li><b>bool</b>, True/False , 表示使用/不使用NMS进行检测框的后处理过滤重叠框</li>
<li><b>None</b>, 不指定,将默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_unclip_ratio</code></td>
<td>检测框的边长缩放倍数;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>检测框的边长缩放倍数;如果不指定,将默认使用1.0</td>
<td><code>float/list/dict/None</code></td>
<td>
<ul>
<li><b>float</b>, 大于0的浮点数如 1.1 , 表示将模型输出的检测框中心不变宽和高都扩张1.1倍</li>
<li><b>列表</b>, 如 [1.2, 1.5] , 表示将模型输出的检测框中心不变宽度扩张1.2倍高度扩张1.5倍</li>
<li><b>字典</b>, 字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>tuple</b>类型,如<code>{0: (1.1, 2.0)}</code>, 表示将模型输出的第0类别检测框中心不变宽度扩张1.1倍高度扩张2.0倍</li>
<li><b>None</b>, 不指定,将默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用1.0</li>
</ul>
</td>
<tr>
<td><code>layout_merge_bboxes_mode</code></td>
<td>模型输出的检测框的合并处理模式;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>模型输出的检测框的合并处理模式;如果不指定,将默认使用union模式</td>
<td><code>string/dict/None</code></td>
<td>
<ul>
@ -425,7 +425,7 @@ for res in output:
<li><b>small</b>, 设置为small表示在模型输出的检测框中对于互相重叠包含的检测框只保留内部被包含的小框删除重叠的外部框。</li>
<li><b>union</b>, 不进行框的过滤处理,内外框都保留</li>
<li><b>dict</b>, 字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>str</b>类型, 如<code>{0: "large", 2: "small"}</code>, 表示对第0类别检测框使用large模式对第2类别检测框使用small模式</li>
<li><b>None</b>, 不指定,将默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用union模式</li>
</ul>
</td>
<td>None</td>
@ -447,7 +447,6 @@ for res in output:
</tr>
</table>
* 其中,`model_name` 必须指定,指定 `model_name` 后,默认使用 PaddleX 内置的模型参数,在此基础上,指定 `model_dir` 时,使用用户自定义的模型。
* 调用目标检测模型的 `predict()` 方法进行推理预测,该方法会返回一个结果列表。另外,本模块还提供了 `predict_iter()` 方法。两者在参数接受和结果返回方面是完全一致的,区别在于 `predict_iter()` 返回的是一个 `generator`,能够逐步处理和获取预测结果,适合处理大型数据集或希望节省内存的场景。可以根据实际需求选择使用这两种方法中的任意一种。`predict()` 方法参数有 `input``batch_size``threshold`,具体说明如下:
@ -491,36 +490,36 @@ for res in output:
<ul>
<li><b>float</b>,如 0.2 表示过滤掉所有阈值小于0.2的目标框</li>
<li><b>字典</b>字典的key为<b>int</b>类型,代表<code>cls_id</code>val为<b>float</b>类型阈值。如 <code>{0: 0.45, 2: 0.48, 7: 0.4}</code>表示对cls_id为0的类别应用阈值0.45、cls_id为1的类别应用阈值0.48、cls_id为7的类别应用阈值0.4</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>threshold</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>threshold</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用0.5</li>
</ul>
</td>
<tr>
<td><code>layout_nms</code></td>
<td>是否使用NMS后处理过滤重叠框如果不指定将默认使用PaddleX官方模型配置</td>
<td>是否使用NMS后处理过滤重叠框如果不指定将默认不使用NMS</td>
<td><code>bool/None</code></td>
<td>
<ul>
<li><b>bool</b>, True/False , 表示使用/不使用NMS进行检测框的后处理过滤重叠框</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_nms</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_nms</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认不使用NMS</li>
</ul>
</td>
<td>None</td>
</tr>
<tr>
<td><code>layout_unclip_ratio</code></td>
<td>检测框的边长缩放倍数;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>检测框的边长缩放倍数;如果不指定,将默认使用1.0</td>
<td><code>float/list/dict/None</code></td>
<td>
<ul>
<li><b>float</b>, 大于0的浮点数如 1.1 , 表示将模型输出的检测框中心不变宽和高都扩张1.1倍</li>
<li><b>列表</b>, 如 [1.2, 1.5] , 表示将模型输出的检测框中心不变宽度扩张1.2倍高度扩张1.5倍</li>
<li><b>字典</b>, 字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>tuple</b>类型,如<code>{0: (1.1, 2.0)}</code>, 表示将模型输出的第0类别检测框中心不变宽度扩张1.1倍高度扩张2.0</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_unclip_ratio</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_unclip_ratio</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用1.0</li>
</ul>
</td>
<tr>
<td><code>layout_merge_bboxes_mode</code></td>
<td>模型输出的检测框的合并处理模式;如果不指定,将默认使用PaddleX官方模型配置</td>
<td>模型输出的检测框的合并处理模式;如果不指定,将默认使用union模式</td>
<td><code>string/dict/None</code></td>
<td>
<ul>
@ -528,7 +527,7 @@ for res in output:
<li><b>small</b>, 设置为small表示在模型输出的检测框中对于互相重叠包含的检测框只保留内部被包含的小框删除重叠的外部框。</li>
<li><b>union</b>, 不进行框的过滤处理,内外框都保留</li>
<li><b>dict</b>, 字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>str</b>类型, 如<code>{0: "large", 2: "small"}</code>, 表示对第0类别检测框使用large模式对第2类别检测框使用small模式</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_merge_bboxes_mode</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用PaddleX官方模型配置</li>
<li><b>None</b>, 不指定,将默认使用 <code>creat_model</code> 指定的 <code>layout_merge_bboxes_mode</code> 参数,如果 <code>creat_model</code> 也没有指定,则默认使用union模式</li>
</ul>
</td>
<td></td>