Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
edfbacf4
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
edfbacf4
编写于
6月 16, 2020
作者:
张欣-男
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/develop' into zxdev
上级
5d639911
63221f80
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
51 addition
and
36 deletion
+51
-36
README.md
README.md
+0
-5
README_en.md
README_en.md
+0
-5
doc/doc_ch/FAQ.md
doc/doc_ch/FAQ.md
+4
-0
ppocr/modeling/architectures/det_model.py
ppocr/modeling/architectures/det_model.py
+10
-3
tools/eval.py
tools/eval.py
+4
-0
tools/export_model.py
tools/export_model.py
+3
-3
tools/infer/predict_det.py
tools/infer/predict_det.py
+6
-1
tools/infer/predict_rec.py
tools/infer/predict_rec.py
+6
-1
tools/infer/predict_system.py
tools/infer/predict_system.py
+4
-3
tools/infer_det.py
tools/infer_det.py
+5
-4
tools/infer_rec.py
tools/infer_rec.py
+6
-8
tools/train.py
tools/train.py
+3
-3
未找到文件。
README.md
浏览文件 @
edfbacf4
...
...
@@ -69,11 +69,6 @@ cd ..
```
bash
# 设置PYTHONPATH环境变量
export
PYTHONPATH
=
.
# windows下设置环境变量
SET
PYTHONPATH
=
.
# 预测image_dir指定的单张图像
python3 tools/infer/predict_system.py
--image_dir
=
"./doc/imgs/11.jpg"
--det_model_dir
=
"./inference/ch_det_mv3_db/"
--rec_model_dir
=
"./inference/ch_rec_mv3_crnn/"
...
...
README_en.md
浏览文件 @
edfbacf4
...
...
@@ -69,11 +69,6 @@ The following code implements text detection and recognition inference tandemly.
```
bash
# Set PYTHONPATH environment variable
export
PYTHONPATH
=
.
# Setting environment variable in Windows
SET
PYTHONPATH
=
.
# Prediction on a single image by specifying image path to image_dir
python3 tools/infer/predict_system.py
--image_dir
=
"./doc/imgs/11.jpg"
--det_model_dir
=
"./inference/ch_det_mv3_db/"
--rec_model_dir
=
"./inference/ch_rec_mv3_crnn/"
...
...
doc/doc_ch/FAQ.md
浏览文件 @
edfbacf4
...
...
@@ -46,3 +46,7 @@ PaddleOCR已完成Windows和Mac系统适配,运行时注意两点:1、在[
报错信息:Input(X) dims
[
3] and Input(Grid) dims[2] should be equal, but received X dimension[3
](
320
)
!= Grid dimension
[
2
](
100
)
原因:TPS模块暂时无法支持变长的输入,请设置 --rec_image_shape='3,32,100' --rec_char_type='en' 固定输入shape
11.
**自定义字典训练的模型,识别结果出现字典里没出现的字**
预测时没有设置采用的自定义字典路径。设置方法是在预测时,通过增加输入参数rec_char_dict_path来设置。
ppocr/modeling/architectures/det_model.py
浏览文件 @
edfbacf4
...
...
@@ -59,16 +59,23 @@ class DetModel(object):
return: (image, corresponding label, dataloader)
"""
image_shape
=
deepcopy
(
self
.
image_shape
)
if
image_shape
[
1
]
%
4
!=
0
or
image_shape
[
2
]
%
4
!=
0
:
raise
Exception
(
"The size of the image must be divisible by 4, "
"received image shape is {}, please reset the "
"Global.image_shape in the yml file"
.
format
(
image_shape
))
image
=
fluid
.
layers
.
data
(
name
=
'image'
,
shape
=
image_shape
,
dtype
=
'float32'
)
if
mode
==
"train"
:
if
self
.
algorithm
==
"EAST"
:
h
,
w
=
int
(
image_shape
[
1
]
//
4
),
int
(
image_shape
[
2
]
//
4
)
score
=
fluid
.
layers
.
data
(
name
=
'score'
,
shape
=
[
1
,
128
,
128
],
dtype
=
'float32'
)
name
=
'score'
,
shape
=
[
1
,
h
,
w
],
dtype
=
'float32'
)
geo
=
fluid
.
layers
.
data
(
name
=
'geo'
,
shape
=
[
9
,
128
,
128
],
dtype
=
'float32'
)
name
=
'geo'
,
shape
=
[
9
,
h
,
w
],
dtype
=
'float32'
)
mask
=
fluid
.
layers
.
data
(
name
=
'mask'
,
shape
=
[
1
,
128
,
128
],
dtype
=
'float32'
)
name
=
'mask'
,
shape
=
[
1
,
h
,
w
],
dtype
=
'float32'
)
feed_list
=
[
image
,
score
,
geo
,
mask
]
labels
=
{
'score'
:
score
,
'geo'
:
geo
,
'mask'
:
mask
}
elif
self
.
algorithm
==
"DB"
:
...
...
tools/eval.py
浏览文件 @
edfbacf4
...
...
@@ -17,6 +17,10 @@ from __future__ import division
from
__future__
import
print_function
import
os
import
sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'..'
))
def
set_paddle_flags
(
**
kwargs
):
...
...
tools/export_model.py
浏览文件 @
edfbacf4
...
...
@@ -18,9 +18,9 @@ from __future__ import print_function
import
os
import
sys
import
time
import
multiprocessing
import
numpy
as
np
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'..'
))
def
set_paddle_flags
(
**
kwargs
):
...
...
tools/infer/predict_det.py
浏览文件 @
edfbacf4
...
...
@@ -11,8 +11,13 @@
# 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.
import
os
import
sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'../..'
))
import
utility
import
tools.infer.utility
as
utility
from
ppocr.utils.utility
import
initial_logger
logger
=
initial_logger
()
from
ppocr.utils.utility
import
get_image_file_list
...
...
tools/infer/predict_rec.py
浏览文件 @
edfbacf4
...
...
@@ -11,8 +11,13 @@
# 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.
import
os
import
sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'../..'
))
import
utility
import
tools.infer.utility
as
utility
from
ppocr.utils.utility
import
initial_logger
logger
=
initial_logger
()
from
ppocr.utils.utility
import
get_image_file_list
...
...
tools/infer/predict_system.py
浏览文件 @
edfbacf4
...
...
@@ -16,12 +16,13 @@ import sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'../..'
))
import
utility
import
tools.infer.utility
as
utility
from
ppocr.utils.utility
import
initial_logger
logger
=
initial_logger
()
import
cv2
import
predict_det
import
predict_rec
import
tools.infer.predict_det
as
predict_det
import
tools.infer.predict_rec
as
predict_rec
import
copy
import
numpy
as
np
import
math
...
...
tools/infer_det.py
浏览文件 @
edfbacf4
...
...
@@ -16,14 +16,15 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
sys
import
time
import
numpy
as
np
from
copy
import
deepcopy
import
json
# from paddle.fluid.contrib.model_stat import summary
import
os
import
sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'..'
))
def
set_paddle_flags
(
**
kwargs
):
...
...
tools/infer_rec.py
浏览文件 @
edfbacf4
...
...
@@ -16,10 +16,12 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
os
import
time
import
multiprocessing
import
numpy
as
np
import
os
import
sys
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'..'
))
def
set_paddle_flags
(
**
kwargs
):
...
...
@@ -35,10 +37,7 @@ set_paddle_flags(
FLAGS_eager_delete_tensor_gb
=
0
,
# enable GC to save memory
)
from
paddle
import
fluid
# from ppocr.utils.utility import load_config, merge_config
import
program
import
tools.program
as
program
from
paddle
import
fluid
from
ppocr.utils.utility
import
initial_logger
logger
=
initial_logger
()
...
...
@@ -47,7 +46,6 @@ from ppocr.utils.save_load import init_model
from
ppocr.utils.character
import
CharacterOps
from
ppocr.utils.utility
import
create_module
from
ppocr.utils.utility
import
get_image_file_list
logger
=
initial_logger
()
def
main
():
...
...
tools/train.py
浏览文件 @
edfbacf4
...
...
@@ -18,9 +18,9 @@ from __future__ import print_function
import
os
import
sys
import
time
import
multiprocessing
import
numpy
as
np
__dir__
=
os
.
path
.
dirname
(
__file__
)
sys
.
path
.
append
(
__dir__
)
sys
.
path
.
append
(
os
.
path
.
join
(
__dir__
,
'..'
))
def
set_paddle_flags
(
**
kwargs
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录