Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#582 from JiabinYang/book03_refine
Browse files Browse the repository at this point in the history
Refine comments and the presentation of inference result for book"03.image_classification"
  • Loading branch information
dzhwinter authored Jul 19, 2018
2 parents 7eaa3f4 + aafd8a2 commit 176734a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 4 additions & 3 deletions 03.image_classification/README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```

本教程中我们提供了VGG和ResNet两个模型的配置。
Expand Down Expand Up @@ -426,7 +427,7 @@ def event_handler(event):

通过`trainer.train`函数训练:

**注意:** CPU,每个 Epoch 将花费大约15~20分钟。这部分可能需要一段时间。请随意修改代码,在GPU上运行测试,以提高培训速度
**注意:** CPU,每个 Epoch 将花费大约15~20分钟。这部分可能需要一段时间。请随意修改代码,在GPU上运行测试,以提高训练速度

```python
trainer.train(
Expand Down Expand Up @@ -499,10 +500,10 @@ img = load_image(cur_dir + '/image/dog.png')
```python
inferencer = fluid.Inferencer(
infer_func=inference_program, param_path=params_dirname, place=place)

label_list = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
# inference
results = inferencer.infer({'pixel': img})
print("infer results: ", results)
print("infer results: %s" % label_list[np.argmax(results[0])])
```

## 总结
Expand Down
4 changes: 3 additions & 1 deletion 03.image_classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ import paddle
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```

Now we are going to walk you through the implementations of the VGG and ResNet.
Expand Down Expand Up @@ -514,9 +515,10 @@ Now we are ready to do inference.
inferencer = fluid.Inferencer(
infer_func=inference_program, param_path=params_dirname, place=place)

label_list = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
# inference
results = inferencer.infer({'pixel': img})
print("infer results: ", results)
print("infer results: %s" % label_list[np.argmax(results[0])])
```


Expand Down
7 changes: 4 additions & 3 deletions 03.image_classification/index.cn.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```

本教程中我们提供了VGG和ResNet两个模型的配置。
Expand Down Expand Up @@ -468,7 +469,7 @@

通过`trainer.train`函数训练:

**注意:** CPU,每个 Epoch 将花费大约15~20分钟。这部分可能需要一段时间。请随意修改代码,在GPU上运行测试,以提高培训速度
**注意:** CPU,每个 Epoch 将花费大约15~20分钟。这部分可能需要一段时间。请随意修改代码,在GPU上运行测试,以提高训练速度

```python
trainer.train(
Expand Down Expand Up @@ -541,10 +542,10 @@
```python
inferencer = fluid.Inferencer(
infer_func=inference_program, param_path=params_dirname, place=place)

label_list = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
# inference
results = inferencer.infer({'pixel': img})
print("infer results: ", results)
print("infer results: %s" % label_list[np.argmax(results[0])])
```

## 总结
Expand Down
4 changes: 3 additions & 1 deletion 03.image_classification/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
import paddle.fluid as fluid
import numpy
import sys
from __future__ import print_function
```

Now we are going to walk you through the implementations of the VGG and ResNet.
Expand Down Expand Up @@ -556,9 +557,10 @@
inferencer = fluid.Inferencer(
infer_func=inference_program, param_path=params_dirname, place=place)

label_list = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
# inference
results = inferencer.infer({'pixel': img})
print("infer results: ", results)
print("infer results: %s" % label_list[np.argmax(results[0])])
```


Expand Down

0 comments on commit 176734a

Please sign in to comment.