Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
c1b5cd74
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 2 年 前同步成功
通知
118
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c1b5cd74
编写于
11月 24, 2021
作者:
C
cuicheng01
提交者:
GitHub
11月 24, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1443 from RainFrost1/search_doc
update vector search doc
上级
3be20579
9a7c36ad
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
32 addition
and
5 deletion
+32
-5
.gitignore
.gitignore
+1
-0
docs/zh_CN/image_recognition_pipeline/vector_search.md
docs/zh_CN/image_recognition_pipeline/vector_search.md
+30
-4
docs/zh_CN/quick_start/quick_start_recognition.md
docs/zh_CN/quick_start/quick_start_recognition.md
+1
-1
未找到文件。
.gitignore
浏览文件 @
c1b5cd74
...
@@ -11,3 +11,4 @@ _build/
...
@@ -11,3 +11,4 @@ _build/
build/
build/
log/
log/
nohup.out
nohup.out
.DS_Store
docs/zh_CN/image_recognition_pipeline/vector_search.md
浏览文件 @
c1b5cd74
...
@@ -9,7 +9,16 @@
...
@@ -9,7 +9,16 @@
值得注意的是,为了更好是适配性,目前版本,
`PaddleClas`
中暂时
**只使用CPU进行向量检索**
。
值得注意的是,为了更好是适配性,目前版本,
`PaddleClas`
中暂时
**只使用CPU进行向量检索**
。
本文档主要主要介绍PaddleClas中检索模块的安装、使用的检索算法,及使用过程中的相关配置文件中参数介绍。
<div
align=
"center"
>
<img
src=
"../../images/structure.jpg"
width =
"800"
/>
</div>
如上图中所示,向量检索部分,在整个
`PP-ShiTu`
系统中有两部分内容
-
图中绿色部分:建立检索库,供检索时查询使用,同时提供增、删等功能
-
图中蓝色部分:检索功能,即给定一张图的特征向量,返回库中相似图像的label
本文档主要主要介绍PaddleClas中检索模块的安装、使用的检索算法、建库流程的及相关配置文件中参数介绍。
## 一、检索库安装
## 一、检索库安装
...
@@ -31,13 +40,26 @@ pip install faiss-cpu==1.7.1post2
...
@@ -31,13 +40,26 @@ pip install faiss-cpu==1.7.1post2
每种检索算法,满足不同场景。其中
`HNSW32`
为默认方法,此方法的检索精度、检索速度可以取得一个较好的平衡,具体算法介绍可以查看
[
官方文档
](
https://github.com/facebookresearch/faiss/wiki
)
。
每种检索算法,满足不同场景。其中
`HNSW32`
为默认方法,此方法的检索精度、检索速度可以取得一个较好的平衡,具体算法介绍可以查看
[
官方文档
](
https://github.com/facebookresearch/faiss/wiki
)
。
## 三、
相关配置文档参数
介绍
## 三、
使用及配置文档
介绍
涉及检索模块配置文件位于:
`deploy/configs/`
下,其中
`build_*.yaml`
是建立特征库的相关配置文件,
`inference_*.yaml`
是检索或者分类的推理配置文件。
涉及检索模块配置文件位于:
`deploy/configs/`
下,其中
`build_*.yaml`
是建立特征库的相关配置文件,
`inference_*.yaml`
是检索或者分类的推理配置文件。
### 3.1 建库配置文件参数
### 3.1 建库及配置文件参数
建库的具体操作如下:
```
shell
# 进入deploy目录
cd
deploy
# yaml文件根据需要改成自己所需的具体yaml文件
python python/build_gallery.py
-c
configs/build_
***
.yaml
```
其中
`yaml`
文件的建库的配置如下,在运行时,请根据实际情况进行修改。建库操作会将根据
`data_file`
的图像列表,将
`image_root`
下的图像进行特征提取,并在
`index_dir`
下进行存储,以待后续检索使用。
其中
`data_file`
文件存储的是图像文件的路径和标签,每一行的格式为:
`image_path label`
。中间间隔以
`yaml`
文件中
`delimiter`
参数作为间隔。
示例建库的配置如下
关于特征提取的具体模型参数,可查看
`yaml`
文件。
```
yaml
```
yaml
# indexing engine config
# indexing engine config
...
@@ -63,6 +85,10 @@ IndexProcess:
...
@@ -63,6 +85,10 @@ IndexProcess:
### 3.2 检索配置文件参数
### 3.2 检索配置文件参数
检索的过程,融合到
`PP-ShiTu`
的整体流程中,请参考
[
README
](
../../../README_ch.md
)
中
`PP-ShiTu图像识别系统介绍`
部分。检索具体使用操作请参考
[
识别快速开始文档
](
../quick_start/quick_start_recognition.md
)
。
其中,检索部分配置如下,整体检索配置文件,请参考
`deploy/configs/inference_*.yaml`
文件。
```
yaml
```
yaml
IndexProcess
:
IndexProcess
:
index_dir
:
"
./recognition_demo_data_v1.1/gallery_logo/index/"
index_dir
:
"
./recognition_demo_data_v1.1/gallery_logo/index/"
...
...
docs/zh_CN/quick_start/quick_start_recognition.md
浏览文件 @
c1b5cd74
...
@@ -259,7 +259,7 @@ python3.7 python/predict_system.py -c configs/inference_general.yaml -o Global.i
...
@@ -259,7 +259,7 @@ python3.7 python/predict_system.py -c configs/inference_general.yaml -o Global.i
python3.7 python/build_gallery.py
-c
configs/build_general.yaml
-o
IndexProcess.data_file
=
"./drink_dataset_v1.0/gallery/drink_label_all.txt"
-o
IndexProcess.index_dir
=
"./drink_dataset_v1.0/index_all"
python3.7 python/build_gallery.py
-c
configs/build_general.yaml
-o
IndexProcess.data_file
=
"./drink_dataset_v1.0/gallery/drink_label_all.txt"
-o
IndexProcess.index_dir
=
"./drink_dataset_v1.0/index_all"
```
```
最终新的索引信息保存在文件夹
`./drink_dataset_v1.0/index_all`
中。
最终新的索引信息保存在文件夹
`./drink_dataset_v1.0/index_all`
中。
具体
`yaml`
请参考
[
向量检索文档
](
../image_recognition_pipeline/vector_search.md
)
。
<a
name=
"基于新的索引库的图像识别"
></a>
<a
name=
"基于新的索引库的图像识别"
></a>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录