Skip to content

Commit c1e5123

Browse files
committed
Update serving interface (#3638)
* Update interfaces * Fix and update
1 parent 97e4cbe commit c1e5123

22 files changed

+162
-66
lines changed

docs/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction_v3.en.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,30 @@ Below are the API references for basic serving and multi-language service invoca
12841284
<td>No</td>
12851285
</tr>
12861286
<tr>
1287+
<td><code>layoutThreshold</code></td>
1288+
<td><code>number</code> | <code>null</code></td>
1289+
<td>Please refer to the description of the <code>layout_threshold</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1290+
<td>No</td>
1291+
</tr>
1292+
<tr>
1293+
<td><code>layoutNms</code></td>
1294+
<td><code>boolean</code> | <code>null</code></td>
1295+
<td>Please refer to the description of the <code>layout_nms</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1296+
<td>No</td>
1297+
</tr>
1298+
<tr>
1299+
<td><code>layoutUnclipRatio</code></td>
1300+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
1301+
<td>Please refer to the description of the <code>layout_unclip_ratio</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1302+
<td>No</td>
1303+
</tr>
1304+
<tr>
1305+
<td><code>layoutMergeBboxesMode</code></td>
1306+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
1307+
<td>Please refer to the description of the <code>layout_merge_bboxes_mode</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1308+
<td>No</td>
1309+
</tr>
1310+
<tr>
12871311
<td><code>textDetLimitSideLen</code></td>
12881312
<td><code>integer</code> | <code>null</code></td>
12891313
<td>Please refer to the description of the <code>text_det_limit_side_len</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>

docs/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction_v3.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ PP-ChatOCRv3-doc 预测的流程、API说明、产出说明如下:
611611
<td>
612612
<ul>
613613
<li><b>str</b>:large,small, union.分别表示重叠框过滤时选择保留大框,小框还是同时保留</li>
614-
<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>
614+
<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>
615615
<li><b>None</b>:如果设置为 <code>None</code>, 将默认使用产线初始化的该参数值,初始化为 <code>large</code>;</li>
616616
</ul>
617617
</td>
@@ -1288,6 +1288,30 @@ for res in visual_predict_res:
12881288
<td>否</td>
12891289
</tr>
12901290
<tr>
1291+
<td><code>layoutThreshold</code></td>
1292+
<td><code>number</code> | <code>null</code></td>
1293+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_threshold</code> 参数相关说明。</td>
1294+
<td>否</td>
1295+
</tr>
1296+
<tr>
1297+
<td><code>layoutNms</code></td>
1298+
<td><code>boolean</code> | <code>null</code></td>
1299+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_nms</code> 参数相关说明。</td>
1300+
<td>否</td>
1301+
</tr>
1302+
<tr>
1303+
<td><code>layoutUnclipRatio</code></td>
1304+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
1305+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_unclip_ratio</code> 参数相关说明。</td>
1306+
<td>否</td>
1307+
</tr>
1308+
<tr>
1309+
<td><code>layoutMergeBboxesMode</code></td>
1310+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
1311+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_merge_bboxes_mode</code> 参数相关说明。</td>
1312+
<td>否</td>
1313+
</tr>
1314+
<tr>
12911315
<td><code>textDetLimitSideLen</code></td>
12921316
<td><code>integer</code> | <code>null</code></td>
12931317
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>text_det_limit_side_len</code> 参数相关说明。</td>

docs/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction_v4.en.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,30 @@ Below are the API references for basic serving and multi-language service invoca
14211421
<td>No</td>
14221422
</tr>
14231423
<tr>
1424+
<td><code>layoutThreshold</code></td>
1425+
<td><code>number</code> | <code>null</code></td>
1426+
<td>Please refer to the description of the <code>layout_threshold</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1427+
<td>No</td>
1428+
</tr>
1429+
<tr>
1430+
<td><code>layoutNms</code></td>
1431+
<td><code>boolean</code> | <code>null</code></td>
1432+
<td>Please refer to the description of the <code>layout_nms</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1433+
<td>No</td>
1434+
</tr>
1435+
<tr>
1436+
<td><code>layoutUnclipRatio</code></td>
1437+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
1438+
<td>Please refer to the description of the <code>layout_unclip_ratio</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1439+
<td>No</td>
1440+
</tr>
1441+
<tr>
1442+
<td><code>layoutMergeBboxesMode</code></td>
1443+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
1444+
<td>Please refer to the description of the <code>layout_merge_bboxes_mode</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>
1445+
<td>No</td>
1446+
</tr>
1447+
<tr>
14241448
<td><code>textDetLimitSideLen</code></td>
14251449
<td><code>integer</code> | <code>null</code></td>
14261450
<td>Please refer to the description of the <code>text_det_limit_side_len</code> parameter of the pipeline object's <code>visual_predict</code> method.</td>

docs/pipeline_usage/tutorials/information_extraction_pipelines/document_scene_information_extraction_v4.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ PP-ChatOCRv4 预测的流程、API说明、产出说明如下:
859859
<td>
860860
<ul>
861861
<li><b>str</b>:large,small, union.分别表示重叠框过滤时选择保留大框,小框还是同时保留</li>
862-
字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>str</b>类型, 如<code>{0: "large", 2: "small"}</code>, 表示对第0类别检测框使用large模式,对第2类别检测框使用small模式</li>
862+
字典的key为<b>int</b>类型,代表<code>cls_id</code>, value为<b>str</b>类型, 如<code>{0: "large", 2: "small"}</code>, 表示对第0类别检测框使用large模式,对第2类别检测框使用small模式</li>
863863
<li><b>None</b>:如果设置为 <code>None</code>, 将默认使用产线初始化的该参数值,初始化为 <code>large</code>;</li>
864864
</ul>
865865
</td>
@@ -1623,6 +1623,30 @@ for res in visual_predict_res:
16231623
<td>否</td>
16241624
</tr>
16251625
<tr>
1626+
<td><code>layoutThreshold</code></td>
1627+
<td><code>number</code> | <code>null</code></td>
1628+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_threshold</code> 参数相关说明。</td>
1629+
<td>否</td>
1630+
</tr>
1631+
<tr>
1632+
<td><code>layoutNms</code></td>
1633+
<td><code>boolean</code> | <code>null</code></td>
1634+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_nms</code> 参数相关说明。</td>
1635+
<td>否</td>
1636+
</tr>
1637+
<tr>
1638+
<td><code>layoutUnclipRatio</code></td>
1639+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
1640+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_unclip_ratio</code> 参数相关说明。</td>
1641+
<td>否</td>
1642+
</tr>
1643+
<tr>
1644+
<td><code>layoutMergeBboxesMode</code></td>
1645+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
1646+
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>layout_merge_bboxes_mode</code> 参数相关说明。</td>
1647+
<td>否</td>
1648+
</tr>
1649+
<tr>
16261650
<td><code>textDetLimitSideLen</code></td>
16271651
<td><code>integer</code> | <code>null</code></td>
16281652
<td>请参阅产线对象中 <code>visual_predict</code> 方法的 <code>text_det_limit_side_len</code> 参数相关说明。</td>

docs/pipeline_usage/tutorials/ocr_pipelines/PP-StructureV3.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,13 +1554,13 @@ Below is the API reference for basic serving deployment and examples of service
15541554
</tr>
15551555
<tr>
15561556
<td><code>layoutUnclipRatio</code></td>
1557-
<td><code>number</code> | <code>array</code> | <code>null</code></td>
1557+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
15581558
<td>Please refer to the description of the <code>layout_unclip_ratio</code> parameter of the pipeline object's <code>predict</code> method.</td>
15591559
<td>No</td>
15601560
</tr>
15611561
<tr>
15621562
<td><code>layoutMergeBboxesMode</code></td>
1563-
<td><code>string</code> | <code>null</code></td>
1563+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
15641564
<td>Please refer to the description of the <code>layout_merge_bboxes_mode</code> parameter of the pipeline object's <code>predict</code> method.</td>
15651565
<td>No</td>
15661566
</tr>

docs/pipeline_usage/tutorials/ocr_pipelines/PP-StructureV3.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,12 @@ for item in markdown_images:
864864
<tr>
865865
<td><code>layout_unclip_ratio</code></td>
866866
<td>版面区域检测模型检测框的扩张系数</td>
867-
<td><code>float|Tuple[float,float]|None</code></td>
867+
<td><code>float|Tuple[float,float]|dict|None</code></td>
868868
<td>
869869
<ul>
870870
<li><b>float</b>:任意大于 <code>0</code> 浮点数;</li>
871871
<li><b>Tuple[float,float]</b>:在横纵两个方向各自的扩张系数;</li>
872+
<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>
872873
<li><b>None</b>:如果设置为 <code>None</code>, 将默认使用产线初始化的该参数值,初始化为 <code>1.0</code>;</li>
873874
</ul>
874875
</td>
@@ -877,10 +878,11 @@ for item in markdown_images:
877878
<tr>
878879
<td><code>layout_merge_bboxes_mode</code></td>
879880
<td>版面区域检测的重叠框过滤方式</td>
880-
<td><code>str|None</code></td>
881+
<td><code>str|dict|None</code></td>
881882
<td>
882883
<ul>
883884
<li><b>str</b>:<code>large</code>,<code>small</code>, <code>union</code>,分别表示重叠框过滤时选择保留大框,小框还是同时保留</li>
885+
<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>
884886
<li><b>None</b>:如果设置为 <code>None</code>, 将默认使用产线初始化的该参数值,初始化为 <code>large</code>;</li>
885887
</ul>
886888
</td>
@@ -1501,13 +1503,13 @@ for res in output:
15011503
</tr>
15021504
<tr>
15031505
<td><code>layoutUnclipRatio</code></td>
1504-
<td><code>number</code> | <code>array</code> | <code>null</code></td>
1506+
<td><code>number</code> | <code>array</code> | <code>object</code> | <code>null</code></td>
15051507
<td>请参阅产线对象中 <code>predict</code> 方法的 <code>layout_unclip_ratio</code> 参数相关说明。</td>
15061508
<td>否</td>
15071509
</tr>
15081510
<tr>
15091511
<td><code>layoutMergeBboxesMode</code></td>
1510-
<td><code>string</code> | <code>null</code></td>
1512+
<td><code>string</code> | <code>object</code> | <code>null</code></td>
15111513
<td>请参阅产线对象中 <code>predict</code> 方法的 <code>layout_merge_bboxes_mode</code> 参数相关说明。</td>
15121514
<td>否</td>
15131515
</tr>

paddlex/inference/serving/basic_serving/_pipeline_apps/layout_parsing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ async def _infer(
6767
seal_det_box_thresh=request.sealDetBoxThresh,
6868
seal_det_unclip_ratio=request.sealDetUnclipRatio,
6969
seal_rec_score_thresh=request.sealRecScoreThresh,
70+
layout_threshold=request.layoutThreshold,
7071
layout_nms=request.layoutNms,
7172
layout_unclip_ratio=request.layoutUnclipRatio,
7273
layout_merge_bboxes_mode=request.layoutMergeBboxesMode,

paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv3_doc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ async def _analyze_images(
5454
use_general_ocr=request.useGeneralOcr,
5555
use_seal_recognition=request.useSealRecognition,
5656
use_table_recognition=request.useTableRecognition,
57+
layout_threshold=request.layoutThreshold,
58+
layout_nms=request.layoutNms,
59+
layout_unclip_ratio=request.layoutUnclipRatio,
60+
layout_merge_bboxes_mode=request.layoutMergeBboxesMode,
5761
text_det_limit_side_len=request.textDetLimitSideLen,
5862
text_det_limit_type=request.textDetLimitType,
5963
text_det_thresh=request.textDetThresh,

paddlex/inference/serving/basic_serving/_pipeline_apps/pp_chatocrv4_doc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ async def _analyze_images(
5454
use_general_ocr=request.useGeneralOcr,
5555
use_seal_recognition=request.useSealRecognition,
5656
use_table_recognition=request.useTableRecognition,
57+
layout_threshold=request.layoutThreshold,
58+
layout_nms=request.layoutNms,
59+
layout_unclip_ratio=request.layoutUnclipRatio,
60+
layout_merge_bboxes_mode=request.layoutMergeBboxesMode,
5761
text_det_limit_side_len=request.textDetLimitSideLen,
5862
text_det_limit_type=request.textDetLimitType,
5963
text_det_thresh=request.textDetThresh,

paddlex/inference/serving/basic_serving/_pipeline_apps/pp_structurev3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ async def _infer(
6767
seal_det_box_thresh=request.sealDetBoxThresh,
6868
seal_det_unclip_ratio=request.sealDetUnclipRatio,
6969
seal_rec_score_thresh=request.sealRecScoreThresh,
70+
layout_threshold=request.layoutThreshold,
7071
layout_nms=request.layoutNms,
7172
layout_unclip_ratio=request.layoutUnclipRatio,
7273
layout_merge_bboxes_mode=request.layoutMergeBboxesMode,

0 commit comments

Comments
 (0)