Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
10ca86ef
M
milvus
项目概览
milvus
/
milvus
接近 1 年 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
10ca86ef
编写于
9月 16, 2021
作者:
W
wt
提交者:
GitHub
9月 16, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[skip ci] Add comment for the accuracy test (#8092)
Signed-off-by:
N
wangting0128
<
ting.wang@zilliz.com
>
上级
5a008c72
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
0 deletion
+11
-0
tests/benchmark/milvus_benchmark/runners/accuracy.py
tests/benchmark/milvus_benchmark/runners/accuracy.py
+11
-0
未找到文件。
tests/benchmark/milvus_benchmark/runners/accuracy.py
浏览文件 @
10ca86ef
...
...
@@ -120,6 +120,7 @@ class AccAccuracyRunner(AccuracyRunner):
def
extract_cases
(
self
,
collection
):
collection_name
=
collection
[
"collection_name"
]
if
"collection_name"
in
collection
else
None
(
data_type
,
dimension
,
metric_type
)
=
parser
.
parse_ann_collection_name
(
collection_name
)
# hdf5_source_file: The path of the source data file saved on the NAS
hdf5_source_file
=
collection
[
"source_file"
]
index_types
=
collection
[
"index_types"
]
index_params
=
collection
[
"index_params"
]
...
...
@@ -136,11 +137,14 @@ class AccAccuracyRunner(AccuracyRunner):
}
filters
=
collection
[
"filters"
]
if
"filters"
in
collection
else
[]
filter_query
=
[]
# Convert list data into a set of dictionary data
search_params
=
utils
.
generate_combinations
(
search_params
)
index_params
=
utils
.
generate_combinations
(
index_params
)
cases
=
list
()
case_metrics
=
list
()
self
.
init_metric
(
self
.
name
,
collection_info
,
{},
search_info
=
None
)
# true_ids: The data set used to verify the results returned by query
true_ids
=
np
.
array
(
dataset
[
"neighbors"
])
for
index_type
in
index_types
:
for
index_param
in
index_params
:
...
...
@@ -192,11 +196,14 @@ class AccAccuracyRunner(AccuracyRunner):
"vector_query"
:
vector_query
,
"true_ids"
:
true_ids
}
# Obtain the parameters of the use case to be tested
cases
.
append
(
case
)
case_metrics
.
append
(
case_metric
)
return
cases
,
case_metrics
def
prepare
(
self
,
**
case_param
):
""" According to the test case parameters, initialize the test """
collection_name
=
case_param
[
"collection_name"
]
metric_type
=
case_param
[
"metric_type"
]
dimension
=
case_param
[
"dimension"
]
...
...
@@ -211,6 +218,7 @@ class AccAccuracyRunner(AccuracyRunner):
self
.
milvus
.
drop
()
dataset
=
case_param
[
"dataset"
]
self
.
milvus
.
create_collection
(
dimension
,
data_type
=
vector_type
)
# Get the data set train for inserting into the collection
insert_vectors
=
utils
.
normalize
(
metric_type
,
np
.
array
(
dataset
[
"train"
]))
if
len
(
insert_vectors
)
!=
dataset
[
"train"
].
shape
[
0
]:
raise
Exception
(
"Row count of insert vectors: %d is not equal to dataset size: %d"
%
(
...
...
@@ -224,6 +232,7 @@ class AccAccuracyRunner(AccuracyRunner):
start
=
i
*
INSERT_INTERVAL
end
=
min
((
i
+
1
)
*
INSERT_INTERVAL
,
len
(
insert_vectors
))
if
start
<
end
:
# Insert up to INSERT_INTERVAL=50000 at a time
tmp_vectors
=
insert_vectors
[
start
:
end
]
ids
=
[
i
for
i
in
range
(
start
,
end
)]
if
not
isinstance
(
tmp_vectors
,
list
):
...
...
@@ -256,7 +265,9 @@ class AccAccuracyRunner(AccuracyRunner):
top_k
=
case_metric
.
search
[
"topk"
]
query_res
=
self
.
milvus
.
query
(
case_param
[
"vector_query"
],
filter_query
=
case_param
[
"filter_query"
])
result_ids
=
self
.
milvus
.
get_ids
(
query_res
)
# Calculate the accuracy of the result of query
acc_value
=
utils
.
get_recall_value
(
true_ids
[:
nq
,
:
top_k
].
tolist
(),
result_ids
)
tmp_result
=
{
"acc"
:
acc_value
}
# Return accuracy results for reporting
return
tmp_result
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录