@@ -115,7 +115,7 @@ from paddlex import create_pipeline
115
115
pipeline = create_pipeline(pipeline = " PP-ShiTuV2" )
116
116
117
117
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 " )
119
119
120
120
output = pipeline.predict(" ./drink_dataset_v2.0/test_images/" , index = index_data)
121
121
for res in output:
@@ -145,7 +145,7 @@ for res in output:
145
145
</tr >
146
146
<tr >
147
147
<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 >
149
149
<td ><code >str</code ></td >
150
150
<td >None</td >
151
151
</tr >
@@ -204,7 +204,7 @@ for res in output:
204
204
<tbody >
205
205
<tr >
206
206
<td ><code >save_path</code ></td >
207
- <td >索引库的保存路径 ,如<code >drink.index </code >。</td >
207
+ <td >索引库文件的保存目录 ,如<code >drink_index </code >。</td >
208
208
<td ><code >str</code ></td >
209
209
<td >无</td >
210
210
</tr >
@@ -258,7 +258,7 @@ for res in output:
258
258
<tbody >
259
259
<tr >
260
260
<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 >
262
262
</tr >
263
263
</tbody >
264
264
</table >
@@ -298,7 +298,7 @@ for res in output:
298
298
299
299
``` python
300
300
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 " )
302
302
303
303
output = pipeline.predict(" ./drink_dataset_v2.0/test_images/" )
304
304
for res in output:
@@ -315,10 +315,10 @@ for res in output:
315
315
from paddlex import create_pipeline
316
316
317
317
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 " )
322
322
```
323
323
324
324
上述方法参数说明如下:
@@ -333,21 +333,27 @@ index_data.save("drink.index")
333
333
</thead >
334
334
<tbody >
335
335
<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 >
339
339
<td >无</td >
340
340
</tr >
341
341
<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 >
345
351
<td >无</td >
346
352
</tr >
347
353
<tr >
348
354
<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 >
351
357
<td >无</td >
352
358
</tr >
353
359
<tr >
@@ -372,7 +378,7 @@ PaddleX 的通用图像识别产线示例需要使用预先构建好的索引库
372
378
data_root # 数据集根目录,目录名称可以改变
373
379
├── images # 图像的保存目录,目录名称可以改变
374
380
│ │ ...
375
- └── gallery.txt # 索引库数据集标注文件,文件名称不可改变 。每行给出待检索图像路径和图像标签,使用空格分隔,内容举例: “0/0.jpg 脉动”
381
+ └── gallery.txt # 索引库数据集标注文件,文件名称可以改变 。每行给出待检索图像路径和图像标签,使用空格分隔,内容举例: “0/0.jpg 脉动”
376
382
```
377
383
378
384
## 3. 开发集成/部署
0 commit comments