Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
book
提交
5829bd37
B
book
项目概览
PaddlePaddle
/
book
通知
16
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
40
列表
看板
标记
里程碑
合并请求
37
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
B
book
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
40
Issue
40
列表
看板
标记
里程碑
合并请求
37
合并请求
37
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5829bd37
编写于
7月 14, 2018
作者:
J
JiabinYang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
insert the header file and change print usage to match python3 style print()
上级
f8007d0b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
16 addition
and
12 deletion
+16
-12
02.recognize_digits/README.cn.md
02.recognize_digits/README.cn.md
+4
-3
02.recognize_digits/README.md
02.recognize_digits/README.md
+4
-3
02.recognize_digits/index.cn.html
02.recognize_digits/index.cn.html
+4
-3
02.recognize_digits/index.html
02.recognize_digits/index.html
+4
-3
未找到文件。
02.recognize_digits/README.cn.md
浏览文件 @
5829bd37
...
...
@@ -155,6 +155,7 @@ PaddlePaddle在API中提供了自动加载[MNIST](http://yann.lecun.com/exdb/mni
```
python
import
paddle
import
paddle.fluid
as
fluid
from
__future__
import
print_function
```
### Program Functions 配置
...
...
@@ -294,8 +295,8 @@ def event_handler(event):
if event.step % 100 == 0:
# event.metrics maps with train program return arguments.
# event.metrics[0] will yeild avg_cost and event.metrics[1] will yeild acc in this example.
print
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
print
(
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
)
if isinstance(event, fluid.EndEpochEvent):
avg_cost, acc = trainer.test(
...
...
@@ -419,7 +420,7 @@ img = load_image(cur_dir + '/image/infer_3.png')
```
python
results = inferencer.infer({'img': img})
lab = np.argsort(results) # probs and lab are the results of one batch data
print
"Inference result of image/infer_3.png is: %d" % lab
[
0
][
0
]
[-1]
print
("Inference result of image/infer_3.png is: %d" % lab
[
0
][
0
]
[-1])
```
## 总结
...
...
02.recognize_digits/README.md
浏览文件 @
5829bd37
...
...
@@ -161,6 +161,7 @@ A PaddlePaddle program starts from importing the API package:
```
python
import
paddle
import
paddle.fluid
as
fluid
from
__future__
import
print_function
```
### Program Functions Configuration
...
...
@@ -300,8 +301,8 @@ def event_handler(event):
if event.step % 100 == 0:
# event.metrics maps with train program return arguments.
# event.metrics[0] will yeild avg_cost and event.metrics[1] will yeild acc in this example.
print
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
print
(
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
)
if isinstance(event, fluid.EndEpochEvent):
avg_cost, acc = trainer.test(
...
...
@@ -432,7 +433,7 @@ Now we are ready to do inference.
```
python
results = inferencer.infer({'img': img})
lab = np.argsort(results) # probs and lab are the results of one batch data
print
"Inference result of image/infer_3.png is: %d" % lab
[
0
][
0
]
[-1]
print
("Inference result of image/infer_3.png is: %d" % lab
[
0
][
0
]
[-1])
```
...
...
02.recognize_digits/index.cn.html
浏览文件 @
5829bd37
...
...
@@ -197,6 +197,7 @@ PaddlePaddle在API中提供了自动加载[MNIST](http://yann.lecun.com/exdb/mni
```python
import paddle
import paddle.fluid as fluid
from __future__ import print_function
```
### Program Functions 配置
...
...
@@ -336,8 +337,8 @@ def event_handler(event):
if event.step % 100 == 0:
# event.metrics maps with train program return arguments.
# event.metrics[0] will yeild avg_cost and event.metrics[1] will yeild acc in this example.
print
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
print
(
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
)
if isinstance(event, fluid.EndEpochEvent):
avg_cost, acc = trainer.test(
...
...
@@ -461,7 +462,7 @@ img = load_image(cur_dir + '/image/infer_3.png')
```python
results = inferencer.infer({'img': img})
lab = np.argsort(results) # probs and lab are the results of one batch data
print
"Inference result of image/infer_3.png is: %d" % lab[0][0][-1]
print
("Inference result of image/infer_3.png is: %d" % lab[0][0][-1])
```
## 总结
...
...
02.recognize_digits/index.html
浏览文件 @
5829bd37
...
...
@@ -203,6 +203,7 @@ A PaddlePaddle program starts from importing the API package:
```python
import paddle
import paddle.fluid as fluid
from __future__ import print_function
```
### Program Functions Configuration
...
...
@@ -342,8 +343,8 @@ def event_handler(event):
if event.step % 100 == 0:
# event.metrics maps with train program return arguments.
# event.metrics[0] will yeild avg_cost and event.metrics[1] will yeild acc in this example.
print
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
print
(
"Pass %d, Batch %d, Cost %f" % (
event.step, event.epoch, event.metrics[0])
)
if isinstance(event, fluid.EndEpochEvent):
avg_cost, acc = trainer.test(
...
...
@@ -474,7 +475,7 @@ Now we are ready to do inference.
```python
results = inferencer.infer({'img': img})
lab = np.argsort(results) # probs and lab are the results of one batch data
print
"Inference result of image/infer_3.png is: %d" % lab[0][0][-1]
print
("Inference result of image/infer_3.png is: %d" % lab[0][0][-1])
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录