Skip to content

Commit 04f26a1

Browse files
committed
update doc
1 parent 1e82999 commit 04f26a1

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

docs/pipeline_usage/tutorials/cv_pipelines/general_image_recognition.md

+24-18
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ from paddlex import create_pipeline
115115
pipeline = create_pipeline(pipeline="PP-ShiTuV2")
116116

117117
index_data = pipeline.build_index(data_root="drink_dataset_v2.0/", label_path="drink_dataset_v2.0/gallery.txt")
118-
index_data.save("drink.index")
118+
index_data.save("drink_index")
119119

120120
output = pipeline.predict("./drink_dataset_v2.0/test_images/", index=index_data)
121121
for res in output:
@@ -145,7 +145,7 @@ for res in output:
145145
</tr>
146146
<tr>
147147
<td><code>index</code></td>
148-
<td>产线推理预测所用的索引库文件路径,如不传入该参数,则需要在<code>predict()</code>中指定<code>index</code>。</td>
148+
<td>产线推理预测所用的索引库,支持:1. <code>str</code>类型表示的目录(该目录下需要包含索引库文件,包括<code>vector.index</code>和<code>index_info.yaml</code>);2. <code>IndexData</code>对象。如不传入该参数,则需要在<code>predict()</code>中指定<code>index</code>。</td>
149149
<td><code>str</code></td>
150150
<td>None</td>
151151
</tr>
@@ -204,7 +204,7 @@ for res in output:
204204
<tbody>
205205
<tr>
206206
<td><code>save_path</code></td>
207-
<td>索引库的保存路径,如<code>drink.index</code>。</td>
207+
<td>索引库文件的保存目录,如<code>drink_index</code>。</td>
208208
<td><code>str</code></td>
209209
<td>无</td>
210210
</tr>
@@ -258,7 +258,7 @@ for res in output:
258258
<tbody>
259259
<tr>
260260
<td><code>index</code></td>
261-
<td>产线推理预测所用的索引库文件路径或是索引库对象,如不传入该参数,则默认使用在<code>create_pipeline()</code>中通过参数<code>index</code>指定的索引库。</td>
261+
<td>产线推理预测所用的索引库,支持:1. <code>str</code>类型表示的目录(该目录下需要包含索引库文件,包括<code>vector.index</code>和<code>index_info.yaml</code>);2. <code>IndexData</code>对象。如不传入该参数,则默认使用在<code>create_pipeline()</code>中通过参数<code>index</code>指定的索引库。</td>
262262
</tr>
263263
</tbody>
264264
</table>
@@ -298,7 +298,7 @@ for res in output:
298298

299299
```python
300300
from paddlex import create_pipeline
301-
pipeline = create_pipeline(pipeline="./my_path/PP-ShiTuV2.yaml", index="drink.index")
301+
pipeline = create_pipeline(pipeline="./my_path/PP-ShiTuV2.yaml", index="drink_index")
302302

303303
output = pipeline.predict("./drink_dataset_v2.0/test_images/")
304304
for res in output:
@@ -315,10 +315,10 @@ for res in output:
315315
from paddlex import create_pipeline
316316

317317
pipeline = create_pipeline("PP-ShiTuV2")
318-
index_data = pipeline.build_index(data_root="drink_dataset_v2.0/", label_path="drink_dataset_v2.0/gallery.txt", index="drink.index", index_type="IVF")
319-
index_data = pipeline.append_index(data_root="drink_dataset_v2.0/", label_path="drink_dataset_v2.0/gallery.txt", index="drink.index", index_type="IVF")
320-
index_data = pipeline.remove_index(data_root="drink_dataset_v2.0/", label_path="drink_dataset_v2.0/gallery.txt", index="drink.index", index_type="IVF")
321-
index_data.save("drink.index")
318+
index_data = pipeline.build_index(gallery_imgs="drink_dataset_v2.0/", gallery_label="drink_dataset_v2.0/gallery.txt", index_type="IVF", metric_type="IP")
319+
index_data = pipeline.append_index(gallery_imgs="drink_dataset_v2.0/", gallery_label="drink_dataset_v2.0/gallery.txt", index=index_data)
320+
index_data = pipeline.remove_index(remove_ids="drink_dataset_v2.0/remove_ids.txt", index=index_data)
321+
index_data.save("drink_index")
322322
```
323323

324324
上述方法参数说明如下:
@@ -333,21 +333,27 @@ index_data.save("drink.index")
333333
</thead>
334334
<tbody>
335335
<tr>
336-
<td><code>data_root</code></td>
337-
<td>要添加的数据集的根目录。数据组织方式与构建索引库时相同,参考<a href="#2.3-构建索引库的数据组织方式">2.3节 构建索引库的数据组织方式</a></td>
338-
<td><code>str</code></td>
336+
<td><code>gallery_imgs</code></td>
337+
<td>要添加的底库图片,支持:1. <code>str</code>类型表示的图片根目录,数据组织方式与构建索引库时相同,参考<a href="#2.3-构建索引库的数据组织方式">2.3节 构建索引库的数据组织方式</a>;2. <code>[numpy.ndarray, numpy.ndarray, ..]</code>类型的底库图片数据。</td>
338+
<td><code>str</code>|<code>list</code></td>
339339
<td>无</td>
340340
</tr>
341341
<tr>
342-
<td><code>label_path</code></td>
343-
<td>要添加的数据集标注文件的路径。数据组织方式与构建索引库时相同,参考<a href="#2.3-构建索引库的数据组织方式">2.3节 构建索引库的数据组织方式</a></td>
344-
<td><code>str</code></td>
342+
<td><code>gallery_label</code></td>
343+
<td>底库图片的标注信息,支持:1. <code>str</code>类型表示的标注文件的路径,数据组织方式与构建索引库时相同,参考<a href="#2.3-构建索引库的数据组织方式">2.3节 构建索引库的数据组织方式</a>;2. <code>[str, str, ..]</code>类型表示的底库图片标注。</td>
344+
<td><code>str</code>|<code>list</code></td>
345+
<td>无</td>
346+
</tr>
347+
<tr>
348+
<td><code>remove_ids</code></td>
349+
<td>待删除的索引序号,支持:1. <code>str</code>类型表示的txt文件的路径,内容为待删除的索引id,每行一个“id”;2. <code>[int, int, ..]</code>类型表示的待删除的索引序号。仅在 <code>remove_index</code> 中有效。</td>
350+
<td><code>str</code>|<code>list</code></td>
345351
<td>无</td>
346352
</tr>
347353
<tr>
348354
<td><code>index</code></td>
349-
<td>索引库文件的路径,或是索引库对象,仅在 <code>append_index</code> 和 <code>remove_index</code> 中有效,表示待修改的索引库。</td>
350-
<td><code>str</code></td>
355+
<td>索引库,支持:1. 索引库文件(<code>vector.index</code>和<code>index_info.yaml</code>)所在目录的路径;2. <code>IndexData</code>类型的索引库对象,仅在 <code>append_index</code> 和 <code>remove_index</code> 中有效,表示待修改的索引库。</td>
356+
<td><code>str</code>|<code>IndexData</code></td>
351357
<td>无</td>
352358
</tr>
353359
<tr>
@@ -372,7 +378,7 @@ PaddleX 的通用图像识别产线示例需要使用预先构建好的索引库
372378
data_root # 数据集根目录,目录名称可以改变
373379
├── images # 图像的保存目录,目录名称可以改变
374380
│ │ ...
375-
└── gallery.txt # 索引库数据集标注文件,文件名称不可改变。每行给出待检索图像路径和图像标签,使用空格分隔,内容举例: “0/0.jpg 脉动”
381+
└── gallery.txt # 索引库数据集标注文件,文件名称可以改变。每行给出待检索图像路径和图像标签,使用空格分隔,内容举例: “0/0.jpg 脉动”
376382
```
377383

378384
## 3. 开发集成/部署

0 commit comments

Comments
 (0)