Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_41840029
PaddleOCR
提交
93f5f473
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看板
提交
93f5f473
编写于
4月 22, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename PaddleOCR to PPOCR
上级
d7b107d1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
21 deletion
+35
-21
deploy/cpp_infer/include/paddleocr.h
deploy/cpp_infer/include/paddleocr.h
+3
-3
deploy/cpp_infer/include/utility.h
deploy/cpp_infer/include/utility.h
+2
-0
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+1
-1
deploy/cpp_infer/src/paddleocr.cpp
deploy/cpp_infer/src/paddleocr.cpp
+14
-15
deploy/cpp_infer/src/utility.cpp
deploy/cpp_infer/src/utility.cpp
+15
-2
未找到文件。
deploy/cpp_infer/include/paddleocr.h
浏览文件 @
93f5f473
...
...
@@ -39,10 +39,10 @@ using namespace paddle_infer;
namespace
PaddleOCR
{
class
P
addle
OCR
{
class
P
P
OCR
{
public:
explicit
P
addle
OCR
();
~
P
addle
OCR
();
explicit
P
P
OCR
();
~
P
P
OCR
();
std
::
vector
<
std
::
vector
<
OCRPredictResult
>>
ocr
(
std
::
vector
<
cv
::
String
>
cv_all_img_names
,
bool
det
=
true
,
bool
rec
=
true
,
bool
cls
=
true
);
...
...
deploy/cpp_infer/include/utility.h
浏览文件 @
93f5f473
...
...
@@ -65,6 +65,8 @@ public:
static
bool
PathExists
(
const
std
::
string
&
path
);
static
void
CreateDir
(
const
std
::
string
&
path
);
static
void
print_result
(
const
std
::
vector
<
OCRPredictResult
>
&
ocr_result
);
};
...
...
deploy/cpp_infer/src/main.cpp
浏览文件 @
93f5f473
...
...
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {
cv
::
glob
(
FLAGS_image_dir
,
cv_all_img_names
);
std
::
cout
<<
"total images num: "
<<
cv_all_img_names
.
size
()
<<
endl
;
P
addleOCR
::
PaddleOCR
ocr
=
PaddleOCR
::
Paddle
OCR
();
P
POCR
ocr
=
PP
OCR
();
std
::
vector
<
std
::
vector
<
OCRPredictResult
>>
ocr_results
=
ocr
.
ocr
(
cv_all_img_names
,
FLAGS_det
,
FLAGS_rec
,
FLAGS_cls
);
...
...
deploy/cpp_infer/src/paddleocr.cpp
浏览文件 @
93f5f473
...
...
@@ -21,7 +21,7 @@
namespace
PaddleOCR
{
P
addleOCR
::
Paddle
OCR
()
{
P
POCR
::
PP
OCR
()
{
if
(
FLAGS_det
)
{
this
->
detector_
=
new
DBDetector
(
FLAGS_det_model_dir
,
FLAGS_use_gpu
,
FLAGS_gpu_id
,
FLAGS_gpu_mem
,
...
...
@@ -45,8 +45,8 @@ PaddleOCR::PaddleOCR() {
}
};
void
P
addle
OCR
::
det
(
cv
::
Mat
img
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
void
P
P
OCR
::
det
(
cv
::
Mat
img
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>>>
boxes
;
std
::
vector
<
double
>
det_times
;
...
...
@@ -63,9 +63,9 @@ void PaddleOCR::det(cv::Mat img, std::vector<OCRPredictResult> &ocr_results,
times
[
2
]
+=
det_times
[
2
];
}
void
P
addle
OCR
::
rec
(
std
::
vector
<
cv
::
Mat
>
img_list
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
void
P
P
OCR
::
rec
(
std
::
vector
<
cv
::
Mat
>
img_list
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
std
::
vector
<
std
::
string
>
rec_texts
(
img_list
.
size
(),
""
);
std
::
vector
<
float
>
rec_text_scores
(
img_list
.
size
(),
0
);
std
::
vector
<
double
>
rec_times
;
...
...
@@ -80,9 +80,9 @@ void PaddleOCR::rec(std::vector<cv::Mat> img_list,
times
[
2
]
+=
rec_times
[
2
];
}
void
P
addle
OCR
::
cls
(
std
::
vector
<
cv
::
Mat
>
img_list
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
void
P
P
OCR
::
cls
(
std
::
vector
<
cv
::
Mat
>
img_list
,
std
::
vector
<
OCRPredictResult
>
&
ocr_results
,
std
::
vector
<
double
>
&
times
)
{
std
::
vector
<
int
>
cls_labels
(
img_list
.
size
(),
0
);
std
::
vector
<
float
>
cls_scores
(
img_list
.
size
(),
0
);
std
::
vector
<
double
>
cls_times
;
...
...
@@ -98,8 +98,8 @@ void PaddleOCR::cls(std::vector<cv::Mat> img_list,
}
std
::
vector
<
std
::
vector
<
OCRPredictResult
>>
P
addle
OCR
::
ocr
(
std
::
vector
<
cv
::
String
>
cv_all_img_names
,
bool
det
,
bool
rec
,
bool
cls
)
{
P
P
OCR
::
ocr
(
std
::
vector
<
cv
::
String
>
cv_all_img_names
,
bool
det
,
bool
rec
,
bool
cls
)
{
std
::
vector
<
double
>
time_info_det
=
{
0
,
0
,
0
};
std
::
vector
<
double
>
time_info_rec
=
{
0
,
0
,
0
};
std
::
vector
<
double
>
time_info_cls
=
{
0
,
0
,
0
};
...
...
@@ -188,9 +188,8 @@ PaddleOCR::ocr(std::vector<cv::String> cv_all_img_names, bool det, bool rec,
return
ocr_results
;
}
// namespace PaddleOCR
void
PaddleOCR
::
log
(
std
::
vector
<
double
>
&
det_times
,
std
::
vector
<
double
>
&
rec_times
,
std
::
vector
<
double
>
&
cls_times
,
int
img_num
)
{
void
PPOCR
::
log
(
std
::
vector
<
double
>
&
det_times
,
std
::
vector
<
double
>
&
rec_times
,
std
::
vector
<
double
>
&
cls_times
,
int
img_num
)
{
if
(
det_times
[
0
]
+
det_times
[
1
]
+
det_times
[
2
]
>
0
)
{
AutoLogger
autolog_det
(
"ocr_det"
,
FLAGS_use_gpu
,
FLAGS_use_tensorrt
,
FLAGS_enable_mkldnn
,
FLAGS_cpu_threads
,
1
,
"dynamic"
,
...
...
@@ -212,7 +211,7 @@ void PaddleOCR::log(std::vector<double> &det_times,
autolog_cls
.
report
();
}
}
P
addleOCR
::~
Paddle
OCR
()
{
P
POCR
::~
PP
OCR
()
{
if
(
this
->
detector_
!=
nullptr
)
{
delete
this
->
detector_
;
}
...
...
deploy/cpp_infer/src/utility.cpp
浏览文件 @
93f5f473
...
...
@@ -16,10 +16,15 @@
#include <include/utility.h>
#include <iostream>
#include <ostream>
#include <sys/stat.h>
#include <sys/types.h>
#include <vector>
#ifdef _WIN32
#include <direct.h>
#else
#include <sys/stat.h>
#endif
namespace
PaddleOCR
{
std
::
vector
<
std
::
string
>
Utility
::
ReadDict
(
const
std
::
string
&
path
)
{
...
...
@@ -206,6 +211,14 @@ bool Utility::PathExists(const std::string &path) {
#endif // !_WIN32
}
void
Utility
::
CreateDir
(
const
std
::
string
&
path
)
{
#ifdef _WIN32
_mkdir
(
path
.
c_str
());
#else
mkdir
(
path
.
c_str
(),
0777
);
#endif // !_WIN32
}
void
Utility
::
print_result
(
const
std
::
vector
<
OCRPredictResult
>
&
ocr_result
)
{
for
(
int
i
=
0
;
i
<
ocr_result
.
size
();
i
++
)
{
std
::
cout
<<
i
<<
"
\t
"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录