Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
77557082
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
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看板
未验证
提交
77557082
编写于
7月 02, 2021
作者:
littletomatodonkey
提交者:
GitHub
7月 02, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add support to append index (#1006)
上级
0a655a65
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
3 deletion
+27
-3
deploy/configs/build_cartoon.yaml
deploy/configs/build_cartoon.yaml
+1
-0
deploy/configs/build_logo.yaml
deploy/configs/build_logo.yaml
+1
-0
deploy/configs/build_product.yaml
deploy/configs/build_product.yaml
+1
-0
deploy/configs/build_vehicle.yaml
deploy/configs/build_vehicle.yaml
+1
-0
deploy/python/build_gallery.py
deploy/python/build_gallery.py
+2
-1
deploy/vector_search/interface.py
deploy/vector_search/interface.py
+21
-2
未找到文件。
deploy/configs/build_cartoon.yaml
浏览文件 @
77557082
...
...
@@ -31,6 +31,7 @@ IndexProcess:
index_path
:
"
./recognition_demo_data_v1.0/gallery_cartoon/index/"
image_root
:
"
./recognition_demo_data_v1.0/gallery_cartoon/"
data_file
:
"
./recognition_demo_data_v1.0/gallery_cartoon/data_file.txt"
append_index
:
False
delimiter
:
"
\t
"
dist_type
:
"
IP"
pq_size
:
100
...
...
deploy/configs/build_logo.yaml
浏览文件 @
77557082
...
...
@@ -29,6 +29,7 @@ IndexProcess:
index_path
:
"
./recognition_demo_data_v1.0/gallery_logo/index/"
image_root
:
"
./recognition_demo_data_v1.0/gallery_logo/"
data_file
:
"
./recognition_demo_data_v1.0/gallery_logo/data_file.txt"
append_index
:
False
delimiter
:
"
\t
"
dist_type
:
"
IP"
pq_size
:
100
...
...
deploy/configs/build_product.yaml
浏览文件 @
77557082
...
...
@@ -29,6 +29,7 @@ IndexProcess:
index_path
:
"
./recognition_demo_data_v1.0/gallery_product/index"
image_root
:
"
./recognition_demo_data_v1.0/gallery_product/"
data_file
:
"
./recognition_demo_data_v1.0/gallery_product/data_file.txt"
append_index
:
False
delimiter
:
"
\t
"
dist_type
:
"
IP"
pq_size
:
100
...
...
deploy/configs/build_vehicle.yaml
浏览文件 @
77557082
...
...
@@ -29,6 +29,7 @@ IndexProcess:
index_path
:
"
./recognition_demo_data_v1.0/gallery_vehicle/index/"
image_root
:
"
./recognition_demo_data_v1.0/gallery_vehicle/"
data_file
:
"
./recognition_demo_data_v1.0/gallery_vehicle/data_file.txt"
append_index
:
False
delimiter
:
"
\t
"
dist_type
:
"
IP"
pq_size
:
100
...
...
deploy/python/build_gallery.py
浏览文件 @
77557082
...
...
@@ -86,7 +86,8 @@ class GalleryBuilder(object):
gallery_vectors
=
gallery_features
,
gallery_docs
=
gallery_docs
,
pq_size
=
config
[
'pq_size'
],
index_path
=
config
[
'index_path'
])
index_path
=
config
[
'index_path'
],
append_index
=
config
[
"append_index"
])
def
main
(
config
):
...
...
deploy/vector_search/interface.py
浏览文件 @
77557082
...
...
@@ -132,7 +132,8 @@ class Graph_Index(object):
gallery_vectors
,
gallery_docs
=
[],
pq_size
=
100
,
index_path
=
'graph_index/'
):
index_path
=
'graph_index/'
,
append_index
=
False
):
"""
build index
"""
...
...
@@ -181,7 +182,25 @@ class Graph_Index(object):
self
.
gallery_doc_dict
[
"dist_type"
]
=
self
.
dist_type
self
.
gallery_doc_dict
[
"with_attr"
]
=
self
.
with_attr
with
open
(
index_path
+
"/info.json"
,
"w"
)
as
f
:
output_path
=
os
.
path
.
join
(
index_path
,
"info.json"
)
if
append_index
is
True
and
os
.
path
.
exists
(
output_path
):
with
open
(
output_path
,
"r"
)
as
fin
:
lines
=
fin
.
readlines
()[
0
]
ori_gallery_doc_dict
=
json
.
loads
(
lines
)
assert
ori_gallery_doc_dict
[
"dist_type"
]
==
self
.
gallery_doc_dict
[
"dist_type"
]
assert
ori_gallery_doc_dict
[
"dim"
]
==
self
.
gallery_doc_dict
[
"dim"
]
assert
ori_gallery_doc_dict
[
"with_attr"
]
==
self
.
gallery_doc_dict
[
"with_attr"
]
offset
=
ori_gallery_doc_dict
[
"total_num"
]
for
i
in
range
(
0
,
self
.
gallery_doc_dict
[
"total_num"
]):
ori_gallery_doc_dict
[
str
(
i
+
offset
)]
=
self
.
gallery_doc_dict
[
str
(
i
)]
ori_gallery_doc_dict
[
"total_num"
]
+=
self
.
gallery_doc_dict
[
"total_num"
]
self
.
gallery_doc_dict
=
ori_gallery_doc_dict
with
open
(
output_path
,
"w"
)
as
f
:
json
.
dump
(
self
.
gallery_doc_dict
,
f
)
print
(
"finished creating index ..."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录