Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
8cd3a681
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看板
提交
8cd3a681
编写于
12月 29, 2021
作者:
S
stephon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update binary model config
上级
d69a6e8f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
20 deletion
+26
-20
deploy/configs/inference_general_binary.yaml
deploy/configs/inference_general_binary.yaml
+9
-11
deploy/python/predict_system.py
deploy/python/predict_system.py
+16
-8
docs/zh_CN/quick_start/quick_start_recognition.md
docs/zh_CN/quick_start/quick_start_recognition.md
+1
-1
未找到文件。
deploy/configs/inference_
product
_binary.yaml
→
deploy/configs/inference_
general
_binary.yaml
浏览文件 @
8cd3a681
Global
:
infer_imgs
:
"
./
recognition_demo_data_v1.1/test_product/daoxiangcunjinzhubing_6.jp
g"
det_inference_model_dir
:
"
./models/p
pyolov2_r50vd_dcn_mainbody
_v1.0_infer"
rec_inference_model_dir
:
"
./models/
product_MV3_x1_0_aliproduct_bin
_v1.0_infer"
infer_imgs
:
"
./
drink_dataset_v1.0/test_images/001.jpe
g"
det_inference_model_dir
:
"
./models/p
icodet_PPLCNet_x2_5_mainbody_lite
_v1.0_infer"
rec_inference_model_dir
:
"
./models/
general_PPLCNet_x2_5_lite_binary
_v1.0_infer"
rec_nms_thresold
:
0.05
batch_size
:
1
...
...
@@ -11,7 +11,6 @@ Global:
labe_list
:
-
foreground
# inference engine config
use_gpu
:
True
enable_mkldnn
:
True
cpu_num_threads
:
10
...
...
@@ -49,19 +48,18 @@ RecPreProcess:
RecPostProcess
:
main_indicator
:
Binarize
Binarize
:
method
:
"
round
"
method
:
"
sign
"
# indexing engine config
IndexProcess
:
index_method
:
"
Flat"
# supported: HNSW32, Flat
i
ndex_dir
:
"
./recognition_demo_data_v1.1/gallery_product/index_binary
"
i
mage_root
:
"
./recognition_demo_data_v1.1/gallery_product/
"
data_file
:
"
./
recognition_demo_data_v1.1/gallery_product/data_file
.txt"
i
mage_root
:
"
./drink_dataset_v1.0/gallery/
"
i
ndex_dir
:
"
./drink_dataset_v1.0/index_bin
"
data_file
:
"
./
drink_dataset_v1.0/gallery/drink_label
.txt"
index_operation
:
"
new"
# suported: "append", "remove", "new"
delimiter
:
"
\t
"
dist_type
:
"
hamming"
embedding_size
:
512
batch_size
:
32
binary_index
:
true
return_k
:
5
score_thres
:
0
\ No newline at end of file
hamming_radius
:
100
\ No newline at end of file
deploy/python/predict_system.py
浏览文件 @
8cd3a681
...
...
@@ -48,7 +48,7 @@ class SystemPredictor(object):
assert
os
.
path
.
exists
(
os
.
path
.
join
(
index_dir
,
"id_map.pkl"
)),
"id_map.pkl not found ... "
if
config
[
'IndexProcess'
].
get
(
"
binary_index"
,
False
)
:
if
config
[
'IndexProcess'
].
get
(
"
dist_type"
)
==
"hamming"
:
self
.
Searcher
=
faiss
.
read_index_binary
(
os
.
path
.
join
(
index_dir
,
"vector.index"
))
else
:
...
...
@@ -102,6 +102,7 @@ class SystemPredictor(object):
# st2: add the whole image for recognition to improve recall
results
=
self
.
append_self
(
results
,
img
.
shape
)
#print(results)
# st3: recognition process, use score_thres to ensure accuracy
for
result
in
results
:
...
...
@@ -113,6 +114,13 @@ class SystemPredictor(object):
scores
,
docs
=
self
.
Searcher
.
search
(
rec_results
,
self
.
return_k
)
# just top-1 result will be returned for the final
if
self
.
config
[
"IndexProcess"
][
"dist_type"
]
==
"hamming"
:
if
scores
[
0
][
0
]
<=
self
.
config
[
"IndexProcess"
][
"hamming_radius"
]:
preds
[
"rec_docs"
]
=
self
.
id_map
[
docs
[
0
][
0
]].
split
()[
1
]
preds
[
"rec_scores"
]
=
scores
[
0
][
0
]
output
.
append
(
preds
)
else
:
if
scores
[
0
][
0
]
>=
self
.
config
[
"IndexProcess"
][
"score_thres"
]:
preds
[
"rec_docs"
]
=
self
.
id_map
[
docs
[
0
][
0
]].
split
()[
1
]
preds
[
"rec_scores"
]
=
scores
[
0
][
0
]
...
...
docs/zh_CN/quick_start/quick_start_recognition.md
浏览文件 @
8cd3a681
...
...
@@ -42,6 +42,7 @@
| ------------ | ------------- | -------- | ------- |
| 轻量级通用主体检测模型 | 通用场景 |
[
tar 格式文件下载链接
](
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer.tar
)
[
zip 格式文件下载链接
]
(https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/picodet_PPLCNet_x2_5_mainbody_lite_v1.0_infer.zip) | - |
| 轻量级通用识别模型 | 通用场景 |
[
tar 格式下载链接
](
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/general_PPLCNet_x2_5_lite_v1.0_infer.tar
)
[
zip 格式文件下载链接
]
(https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/general_PPLCNet_x2_5_lite_v1.0_infer.zip) |
[
inference_general.yaml
](
../../../deploy/configs/inference_general.yaml
)
|
| 轻量级通用识别二值模型 | 存储受限场景 |
[
tar.gz 格式下载链接
](
https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/models/inference/general_PPLCNet_x2_5_lite_binary_v1.0_infer.tar.gz
)
|
[
inference_general_binary.yaml
](
../../../deploy/configs/inference_general_binary.yaml
)
|
注意:由于部分解压缩软件在解压上述
`tar`
格式文件时存在问题,建议非命令行用户下载
`zip`
格式文件并解压。
`tar`
格式文件建议使用命令
`tar xf xxx.tar`
解压。
...
...
@@ -339,4 +340,3 @@ wget https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/rec/data/recognit
按照上述步骤下载模型和测试数据后,您可以进行相关方向识别模型的测试。
*
更多关于主体检测的介绍可以参考:
[
主体检测教程文档
](
../image_recognition_pipeline/mainbody_detection.md
)
;关于特征提取的介绍可以参考:
[
特征提取教程文档
](
../image_recognition_pipeline/feature_extraction.md
)
;关于向量检索的介绍可以参考:
[
向量检索教程文档
](
../image_recognition_pipeline/vector_search.md
)
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录