Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
a96305c2
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
1 年多 前同步成功
通知
116
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看板
提交
a96305c2
编写于
11月 12, 2021
作者:
D
dongshuilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cpp_shitu code is fine
上级
74da43ad
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
12 deletion
+13
-12
deploy/cpp_shitu/include/preprocess_op_det.h
deploy/cpp_shitu/include/preprocess_op_det.h
+2
-2
deploy/cpp_shitu/include/vector_search.h
deploy/cpp_shitu/include/vector_search.h
+1
-0
deploy/cpp_shitu/src/main.cpp
deploy/cpp_shitu/src/main.cpp
+1
-1
deploy/cpp_shitu/src/preprocess_op_det.cpp
deploy/cpp_shitu/src/preprocess_op_det.cpp
+9
-9
未找到文件。
deploy/cpp_shitu/include/preprocess_op_det.h
浏览文件 @
a96305c2
...
...
@@ -91,12 +91,12 @@ public:
}
// Compute best resize scale for x-dimension, y-dimension
std
::
pair
<
float
,
float
>
GenerateScale
(
const
cv
::
Mat
&
im
);
std
::
pair
<
double
,
double
>
GenerateScale
(
const
cv
::
Mat
&
im
);
virtual
void
Run
(
cv
::
Mat
*
im
,
ImageBlob
*
data
);
private:
int
interp_
;
int
interp_
=
2
;
bool
keep_ratio_
;
std
::
vector
<
int
>
target_size_
;
std
::
vector
<
int
>
in_net_shape_
;
...
...
deploy/cpp_shitu/include/vector_search.h
浏览文件 @
a96305c2
...
...
@@ -50,6 +50,7 @@ public:
void
LoadIndexFile
();
const
SearchResult
&
Search
(
float
*
feature
,
int
query_number
);
const
std
::
string
&
GetLabel
(
faiss
::
Index
::
idx_t
ind
);
const
float
&
GetThreshold
()
{
return
this
->
score_thres
;
}
private:
std
::
string
index_dir
;
...
...
deploy/cpp_shitu/src/main.cpp
浏览文件 @
a96305c2
...
...
@@ -266,7 +266,7 @@ int main(int argc, char **argv) {
for
(
int
i
=
0
;
i
<
det_result
.
size
();
++
i
)
{
det_result
[
i
].
confidence
=
search_result
.
D
[
search_result
.
return_k
*
i
];
}
NMSBoxes
(
det_result
,
detecto
r
.
GetThreshold
(),
rec_nms_thresold
,
indeices
);
NMSBoxes
(
det_result
,
searche
r
.
GetThreshold
(),
rec_nms_thresold
,
indeices
);
// print result
PrintResult
(
img_path
,
det_result
,
indeices
,
searcher
,
search_result
);
...
...
deploy/cpp_shitu/src/preprocess_op_det.cpp
浏览文件 @
a96305c2
...
...
@@ -72,8 +72,8 @@ void Resize::Run(cv::Mat *im, ImageBlob *data) {
};
}
std
::
pair
<
float
,
float
>
Resize
::
GenerateScale
(
const
cv
::
Mat
&
im
)
{
std
::
pair
<
float
,
float
>
resize_scale
;
std
::
pair
<
double
,
double
>
Resize
::
GenerateScale
(
const
cv
::
Mat
&
im
)
{
std
::
pair
<
double
,
double
>
resize_scale
;
int
origin_w
=
im
.
cols
;
int
origin_h
=
im
.
rows
;
...
...
@@ -84,17 +84,17 @@ std::pair<float, float> Resize::GenerateScale(const cv::Mat &im) {
*
std
::
max_element
(
target_size_
.
begin
(),
target_size_
.
end
());
int
target_size_min
=
*
std
::
min_element
(
target_size_
.
begin
(),
target_size_
.
end
());
float
scale_min
=
static_cast
<
float
>
(
target_size_min
)
/
static_cast
<
float
>
(
im_size_min
);
float
scale_max
=
static_cast
<
float
>
(
target_size_max
)
/
static_cast
<
float
>
(
im_size_max
);
float
scale_ratio
=
std
::
min
(
scale_min
,
scale_max
);
double
scale_min
=
static_cast
<
double
>
(
target_size_min
)
/
static_cast
<
double
>
(
im_size_min
);
double
scale_max
=
static_cast
<
double
>
(
target_size_max
)
/
static_cast
<
double
>
(
im_size_max
);
double
scale_ratio
=
std
::
min
(
scale_min
,
scale_max
);
resize_scale
=
{
scale_ratio
,
scale_ratio
};
}
else
{
resize_scale
.
first
=
static_cast
<
float
>
(
target_size_
[
1
])
/
static_cast
<
float
>
(
origin_w
);
static_cast
<
double
>
(
target_size_
[
1
])
/
static_cast
<
double
>
(
origin_w
);
resize_scale
.
second
=
static_cast
<
float
>
(
target_size_
[
0
])
/
static_cast
<
float
>
(
origin_h
);
static_cast
<
double
>
(
target_size_
[
0
])
/
static_cast
<
double
>
(
origin_h
);
}
return
resize_scale
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录