Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
490b85cf
M
models
项目概览
PaddlePaddle
/
models
接近 2 年 前同步成功
通知
230
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
490b85cf
编写于
4月 15, 2019
作者:
W
whs
提交者:
GitHub
4月 15, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix eval.py in ocr ctc demo. (#1970)
上级
6137a6b0
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
9 deletion
+17
-9
PaddleCV/ocr_recognition/README.md
PaddleCV/ocr_recognition/README.md
+7
-5
PaddleCV/ocr_recognition/data_reader.py
PaddleCV/ocr_recognition/data_reader.py
+6
-1
PaddleCV/ocr_recognition/eval.py
PaddleCV/ocr_recognition/eval.py
+4
-3
未找到文件。
PaddleCV/ocr_recognition/README.md
浏览文件 @
490b85cf
运行本目录下的程序示例需要使用PaddlePaddle develop最新版本。如果您的PaddlePaddle安装版本低于此要求,请按照
[
安装文档
](
http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/pip_install_cn.html
)
中的说明更新PaddlePaddle安装版本。
...
...
@@ -156,12 +155,13 @@ env CUDA_VISIBLE_DEVICES=0,1,2,3 python train.py --parallel=True
通过以下命令调用评估脚本用指定数据集对模型进行评估:
```
env CUDA_VISIBLE_DEVICE=0 python eval.py \
env CUDA_VISIBLE_DEVICE
S
=0 python eval.py \
--model_path="./models/model_0" \
--input_images_dir="./eval_data/images/" \
--input_images_list="./eval_data/eval_list
\" \
--input_images_list="./eval_data/eval_list
"
```
执行
`python train.py --help`
可查看参数详细说明。
...
...
@@ -170,7 +170,7 @@ env CUDA_VISIBLE_DEVICE=0 python eval.py \
从标准输入读取一张图片的路径,并对齐进行预测:
```
env CUDA_VISIBLE_DEVICE=0 python infer.py \
env CUDA_VISIBLE_DEVICE
S
=0 python infer.py \
--model_path="models/model_00044_15000"
```
...
...
@@ -193,7 +193,7 @@ result: [2067 2067 8187 8477 5027 7191 2431 1462]
从文件中批量读取图片路径,并对其进行预测:
```
env CUDA_VISIBLE_DEVICE=0 python infer.py \
env CUDA_VISIBLE_DEVICE
S
=0 python infer.py \
--model_path="models/model_00044_15000" \
--input_images_list="data/test.list"
```
...
...
@@ -204,3 +204,5 @@ env CUDA_VISIBLE_DEVICE=0 python infer.py \
|- |:-: |
|
[
ocr_ctc_params
](
https://paddle-ocr-models.bj.bcebos.com/ocr_ctc.zip
)
| 22.3% |
|
[
ocr_attention_params
](
https://paddle-ocr-models.bj.bcebos.com/ocr_attention.zip
)
| 15.8%|
>在本文示例中,均可通过修改`CUDA_VISIBLE_DEVICES`改变当前任务使用的显卡号。
PaddleCV/ocr_recognition/data_reader.py
浏览文件 @
490b85cf
...
...
@@ -10,6 +10,11 @@ from os import path
from
paddle.dataset.image
import
load_image
import
paddle
try
:
input
=
raw_input
except
NameError
:
pass
SOS
=
0
EOS
=
1
NUM_CLASSES
=
95
...
...
@@ -175,7 +180,7 @@ class DataGenerator(object):
yield
img
,
label
else
:
while
True
:
img_path
=
raw_
input
(
"Please input the path of image: "
)
img_path
=
input
(
"Please input the path of image: "
)
img
=
Image
.
open
(
img_path
).
convert
(
'L'
)
img
=
np
.
array
(
img
)
-
127.5
img
=
img
[
np
.
newaxis
,
...]
...
...
PaddleCV/ocr_recognition/eval.py
浏览文件 @
490b85cf
...
...
@@ -31,7 +31,8 @@ def evaluate(args):
num_classes
=
data_reader
.
num_classes
()
data_shape
=
data_reader
.
data_shape
()
# define network
evaluator
,
cost
=
eval
(
data_shape
,
num_classes
)
evaluator
,
cost
=
eval
(
data_shape
,
num_classes
,
use_cudnn
=
True
if
args
.
use_gpu
else
False
)
# data reader
test_reader
=
data_reader
.
test
(
...
...
@@ -62,8 +63,8 @@ def evaluate(args):
count
+=
1
exe
.
run
(
fluid
.
default_main_program
(),
feed
=
get_feeder_data
(
data
,
place
))
avg_distance
,
avg_seq_error
=
evaluator
.
eval
(
exe
)
print
(
"Read %d samples; avg_distance: %s; avg_seq_error: %s"
%
(
count
,
avg_distance
,
avg_seq_error
))
print
(
"Read %d samples; avg_distance: %s; avg_seq_error: %s"
%
(
count
,
avg_distance
,
avg_seq_error
))
def
main
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录