Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
9336e344
P
PaddleOCR
项目概览
weixin_41840029
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9336e344
编写于
1月 07, 2021
作者:
L
littletomatodonkey
提交者:
GitHub
1月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix cpp infer (#1682)
上级
a27bd4d5
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
8 addition
and
9 deletion
+8
-9
deploy/cpp_infer/include/ocr_cls.h
deploy/cpp_infer/include/ocr_cls.h
+1
-1
deploy/cpp_infer/include/ocr_det.h
deploy/cpp_infer/include/ocr_det.h
+2
-3
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+2
-2
deploy/cpp_infer/src/ocr_cls.cpp
deploy/cpp_infer/src/ocr_cls.cpp
+1
-1
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+2
-2
未找到文件。
deploy/cpp_infer/include/ocr_cls.h
浏览文件 @
9336e344
...
@@ -40,7 +40,7 @@ public:
...
@@ -40,7 +40,7 @@ public:
const
int
&
gpu_id
,
const
int
&
gpu_mem
,
const
int
&
gpu_id
,
const
int
&
gpu_mem
,
const
int
&
cpu_math_library_num_threads
,
const
int
&
cpu_math_library_num_threads
,
const
bool
&
use_mkldnn
,
const
double
&
cls_thresh
,
const
bool
&
use_mkldnn
,
const
double
&
cls_thresh
,
const
bool
&
use_tensorrt
,
const
&
bool
use_fp16
)
{
const
bool
&
use_tensorrt
,
const
bool
&
use_fp16
)
{
this
->
use_gpu_
=
use_gpu
;
this
->
use_gpu_
=
use_gpu
;
this
->
gpu_id_
=
gpu_id
;
this
->
gpu_id_
=
gpu_id
;
this
->
gpu_mem_
=
gpu_mem
;
this
->
gpu_mem_
=
gpu_mem
;
...
...
deploy/cpp_infer/include/ocr_det.h
浏览文件 @
9336e344
...
@@ -44,9 +44,8 @@ public:
...
@@ -44,9 +44,8 @@ public:
const
bool
&
use_mkldnn
,
const
int
&
max_side_len
,
const
bool
&
use_mkldnn
,
const
int
&
max_side_len
,
const
double
&
det_db_thresh
,
const
double
&
det_db_thresh
,
const
double
&
det_db_box_thresh
,
const
double
&
det_db_box_thresh
,
const
double
&
det_db_unclip_ratio
,
const
double
&
det_db_unclip_ratio
,
const
bool
&
visualize
,
const
bool
&
visualize
const
bool
&
use_tensorrt
,
const
bool
&
use_tensorrt
,
const
bool
&
use_fp16
)
{
const
bool
&
use_fp16
)
{
this
->
use_gpu_
=
use_gpu
;
this
->
use_gpu_
=
use_gpu
;
this
->
gpu_id_
=
gpu_id
;
this
->
gpu_id_
=
gpu_id
;
this
->
gpu_mem_
=
gpu_mem
;
this
->
gpu_mem_
=
gpu_mem
;
...
...
deploy/cpp_infer/src/main.cpp
浏览文件 @
9336e344
...
@@ -77,11 +77,11 @@ int main(int argc, char **argv) {
...
@@ -77,11 +77,11 @@ int main(int argc, char **argv) {
auto
end
=
std
::
chrono
::
system_clock
::
now
();
auto
end
=
std
::
chrono
::
system_clock
::
now
();
auto
duration
=
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
end
-
start
);
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
end
-
start
);
std
::
cout
<<
"
花费了
"
std
::
cout
<<
"
Cost
"
<<
double
(
duration
.
count
())
*
<<
double
(
duration
.
count
())
*
std
::
chrono
::
microseconds
::
period
::
num
/
std
::
chrono
::
microseconds
::
period
::
num
/
std
::
chrono
::
microseconds
::
period
::
den
std
::
chrono
::
microseconds
::
period
::
den
<<
"
秒
"
<<
std
::
endl
;
<<
"
s
"
<<
std
::
endl
;
return
0
;
return
0
;
}
}
deploy/cpp_infer/src/ocr_cls.cpp
浏览文件 @
9336e344
...
@@ -88,7 +88,7 @@ void Classifier::LoadModel(const std::string &model_dir) {
...
@@ -88,7 +88,7 @@ void Classifier::LoadModel(const std::string &model_dir) {
if
(
this
->
use_mkldnn_
)
{
if
(
this
->
use_mkldnn_
)
{
config
.
EnableMKLDNN
();
config
.
EnableMKLDNN
();
}
}
config
.
SetCpuMathLibraryNumThreads
(
this
->
cpu_math_library_num_threads_
)
config
.
SetCpuMathLibraryNumThreads
(
this
->
cpu_math_library_num_threads_
)
;
}
}
// false for zero copy tensor
// false for zero copy tensor
...
...
deploy/cpp_infer/src/ocr_rec.cpp
浏览文件 @
9336e344
...
@@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
...
@@ -76,7 +76,7 @@ void CRNNRecognizer::Run(std::vector<std::vector<std::vector<int>>> boxes,
float
(
*
std
::
max_element
(
&
predict_batch
[
n
*
predict_shape
[
2
]],
float
(
*
std
::
max_element
(
&
predict_batch
[
n
*
predict_shape
[
2
]],
&
predict_batch
[(
n
+
1
)
*
predict_shape
[
2
]]));
&
predict_batch
[(
n
+
1
)
*
predict_shape
[
2
]]));
if
(
argmax_idx
>
0
&&
(
not
(
i
>
0
&&
argmax_idx
==
last_index
)))
{
if
(
argmax_idx
>
0
&&
(
!
(
i
>
0
&&
argmax_idx
==
last_index
)))
{
score
+=
max_value
;
score
+=
max_value
;
count
+=
1
;
count
+=
1
;
str_res
.
push_back
(
label_list_
[
argmax_idx
]);
str_res
.
push_back
(
label_list_
[
argmax_idx
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录