Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
f889907c
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f889907c
编写于
4月 09, 2022
作者:
文幕地方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move args to args.h
上级
15a22fa0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
31 deletion
+92
-31
deploy/cpp_infer/include/args.h
deploy/cpp_infer/include/args.h
+46
-0
deploy/cpp_infer/src/args.cpp
deploy/cpp_infer/src/args.cpp
+45
-0
deploy/cpp_infer/src/main.cpp
deploy/cpp_infer/src/main.cpp
+1
-31
未找到文件。
deploy/cpp_infer/include/args.h
0 → 100644
浏览文件 @
f889907c
// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <gflags/gflags.h>
// common args
DECLARE_bool
(
use_gpu
);
DECLARE_bool
(
use_tensorrt
);
DECLARE_int32
(
gpu_id
);
DECLARE_int32
(
gpu_mem
);
DECLARE_int32
(
cpu_threads
);
DECLARE_bool
(
enable_mkldnn
);
DECLARE_string
(
precision
);
DECLARE_bool
(
benchmark
);
DECLARE_string
(
output
);
DECLARE_string
(
image_dir
);
DECLARE_bool
(
visualize
);
// detection related
DECLARE_string
(
det_model_dir
);
DECLARE_int32
(
max_side_len
);
DECLARE_double
(
det_db_thresh
);
DECLARE_double
(
det_db_box_thresh
);
DECLARE_double
(
det_db_unclip_ratio
);
DECLARE_bool
(
use_dilation
);
DECLARE_string
(
det_db_score_mode
);
// classification related
DECLARE_bool
(
use_angle_cls
);
DECLARE_string
(
cls_model_dir
);
DECLARE_double
(
cls_thresh
);
// recognition related
DECLARE_string
(
rec_model_dir
);
DECLARE_int32
(
rec_batch_num
);
DECLARE_string
(
rec_char_dict_path
);
\ No newline at end of file
deploy/cpp_infer/src/args.cpp
0 → 100644
浏览文件 @
f889907c
// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gflags/gflags.h>
// common args
DEFINE_bool
(
use_gpu
,
false
,
"Infering with GPU or CPU."
);
DEFINE_bool
(
use_tensorrt
,
false
,
"Whether use tensorrt."
);
DEFINE_int32
(
gpu_id
,
0
,
"Device id of GPU to execute."
);
DEFINE_int32
(
gpu_mem
,
4000
,
"GPU id when infering with GPU."
);
DEFINE_int32
(
cpu_threads
,
10
,
"Num of threads with CPU."
);
DEFINE_bool
(
enable_mkldnn
,
false
,
"Whether use mkldnn with CPU."
);
DEFINE_string
(
precision
,
"fp32"
,
"Precision be one of fp32/fp16/int8"
);
DEFINE_bool
(
benchmark
,
false
,
"Whether use benchmark."
);
DEFINE_string
(
output
,
"./output/"
,
"Save benchmark log path."
);
DEFINE_string
(
image_dir
,
""
,
"Dir of input image."
);
DEFINE_bool
(
visualize
,
true
,
"Whether show the detection results."
);
// detection related
DEFINE_string
(
det_model_dir
,
""
,
"Path of det inference model."
);
DEFINE_int32
(
max_side_len
,
960
,
"max_side_len of input image."
);
DEFINE_double
(
det_db_thresh
,
0.3
,
"Threshold of det_db_thresh."
);
DEFINE_double
(
det_db_box_thresh
,
0.6
,
"Threshold of det_db_box_thresh."
);
DEFINE_double
(
det_db_unclip_ratio
,
1.5
,
"Threshold of det_db_unclip_ratio."
);
DEFINE_bool
(
use_dilation
,
false
,
"Whether use the dilation on output map."
);
DEFINE_string
(
det_db_score_mode
,
"slow"
,
"Whether use polygon score."
);
// classification related
DEFINE_bool
(
use_angle_cls
,
false
,
"Whether use use_angle_cls."
);
DEFINE_string
(
cls_model_dir
,
""
,
"Path of cls inference model."
);
DEFINE_double
(
cls_thresh
,
0.9
,
"Threshold of cls_thresh."
);
// recognition related
DEFINE_string
(
rec_model_dir
,
""
,
"Path of rec inference model."
);
DEFINE_int32
(
rec_batch_num
,
6
,
"rec_batch_num."
);
DEFINE_string
(
rec_char_dict_path
,
"../../ppocr/utils/ppocr_keys_v1.txt"
,
"Path of dictionary."
);
\ No newline at end of file
deploy/cpp_infer/src/main.cpp
浏览文件 @
f889907c
...
...
@@ -27,6 +27,7 @@
#include <fstream>
#include <numeric>
#include <include/args.h>
#include <include/ocr_cls.h>
#include <include/ocr_det.h>
#include <include/ocr_rec.h>
...
...
@@ -34,37 +35,6 @@
#include <sys/stat.h>
#include "auto_log/autolog.h"
#include <gflags/gflags.h>
// common args
DEFINE_bool
(
use_gpu
,
false
,
"Infering with GPU or CPU."
);
DEFINE_bool
(
use_tensorrt
,
false
,
"Whether use tensorrt."
);
DEFINE_int32
(
gpu_id
,
0
,
"Device id of GPU to execute."
);
DEFINE_int32
(
gpu_mem
,
4000
,
"GPU id when infering with GPU."
);
DEFINE_int32
(
cpu_threads
,
10
,
"Num of threads with CPU."
);
DEFINE_bool
(
enable_mkldnn
,
false
,
"Whether use mkldnn with CPU."
);
DEFINE_string
(
precision
,
"fp32"
,
"Precision be one of fp32/fp16/int8"
);
DEFINE_bool
(
benchmark
,
false
,
"Whether use benchmark."
);
DEFINE_string
(
output
,
"./output/"
,
"Save benchmark log path."
);
DEFINE_string
(
image_dir
,
""
,
"Dir of input image."
);
DEFINE_bool
(
visualize
,
true
,
"Whether show the detection results."
);
// detection related
DEFINE_string
(
det_model_dir
,
""
,
"Path of det inference model."
);
DEFINE_int32
(
max_side_len
,
960
,
"max_side_len of input image."
);
DEFINE_double
(
det_db_thresh
,
0.3
,
"Threshold of det_db_thresh."
);
DEFINE_double
(
det_db_box_thresh
,
0.6
,
"Threshold of det_db_box_thresh."
);
DEFINE_double
(
det_db_unclip_ratio
,
1.5
,
"Threshold of det_db_unclip_ratio."
);
DEFINE_bool
(
use_dilation
,
false
,
"Whether use the dilation on output map."
);
DEFINE_string
(
det_db_score_mode
,
"slow"
,
"Whether use polygon score."
);
// classification related
DEFINE_bool
(
use_angle_cls
,
false
,
"Whether use use_angle_cls."
);
DEFINE_string
(
cls_model_dir
,
""
,
"Path of cls inference model."
);
DEFINE_double
(
cls_thresh
,
0.9
,
"Threshold of cls_thresh."
);
// recognition related
DEFINE_string
(
rec_model_dir
,
""
,
"Path of rec inference model."
);
DEFINE_int32
(
rec_batch_num
,
6
,
"rec_batch_num."
);
DEFINE_string
(
rec_char_dict_path
,
"../../ppocr/utils/ppocr_keys_v1.txt"
,
"Path of dictionary."
);
using
namespace
std
;
using
namespace
cv
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录