提交 702cb6b0 编写于 作者: K kinghuin

fix path error and add infer_3 url test=develop

上级 43281f29
...@@ -524,7 +524,7 @@ Test with Epoch 0, avg_cost: 0.053097883707459624, acc: 0.9822850318471338 ...@@ -524,7 +524,7 @@ Test with Epoch 0, avg_cost: 0.053097883707459624, acc: 0.9822850318471338
### 生成预测输入数据 ### 生成预测输入数据
`infer_3.png` 是数字 3 的一个示例图像。把它变成一个 numpy 数组以匹配数据feed格式。 [infer_3.png](https://github.com/PaddlePaddle/book/blob/develop/02.recognize_digits/image/infer_3.png) 是数字 3 的一个示例图像。把它变成一个 numpy 数组以匹配数据feed格式。
```python ```python
def load_image(file): def load_image(file):
...@@ -558,7 +558,7 @@ with fluid.scope_guard(inference_scope): ...@@ -558,7 +558,7 @@ with fluid.scope_guard(inference_scope):
lab = numpy.argsort(results) lab = numpy.argsort(results)
# 打印 infer_3.png 这张图片的预测结果 # 打印 infer_3.png 这张图片的预测结果
img=Image.open('image/infer_3.png') img=Image.open(cur_dir + 'image/infer_3.png')
plt.imshow(img) plt.imshow(img)
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])
``` ```
......
...@@ -508,7 +508,7 @@ You can use trained model to classify handwriting pictures of digits. The progra ...@@ -508,7 +508,7 @@ You can use trained model to classify handwriting pictures of digits. The progra
### Generate input data to be inferred ### Generate input data to be inferred
`infer_3.png` is an example picture of number 3. Transform it into a numpy to match feed data format [infer_3.png](https://github.com/PaddlePaddle/book/blob/develop/02.recognize_digits/image/infer_3.png) is an example picture of number 3. Transform it into a numpy to match feed data format
```python ```python
...@@ -547,7 +547,7 @@ with fluid.scope_guard(inference_scope): ...@@ -547,7 +547,7 @@ with fluid.scope_guard(inference_scope):
lab = numpy.argsort(results) lab = numpy.argsort(results)
# Print prediction result of infer_3.png # Print prediction result of infer_3.png
img=Image.open('image/infer_3.png') img=Image.open(cur_dir + 'image/infer_3.png')
plt.imshow(img) plt.imshow(img)
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])
``` ```
......
...@@ -566,7 +566,7 @@ Test with Epoch 0, avg_cost: 0.053097883707459624, acc: 0.9822850318471338 ...@@ -566,7 +566,7 @@ Test with Epoch 0, avg_cost: 0.053097883707459624, acc: 0.9822850318471338
### 生成预测输入数据 ### 生成预测输入数据
`infer_3.png` 是数字 3 的一个示例图像。把它变成一个 numpy 数组以匹配数据feed格式。 [infer_3.png](https://github.com/PaddlePaddle/book/blob/develop/02.recognize_digits/image/infer_3.png) 是数字 3 的一个示例图像。把它变成一个 numpy 数组以匹配数据feed格式。
```python ```python
def load_image(file): def load_image(file):
...@@ -600,7 +600,7 @@ with fluid.scope_guard(inference_scope): ...@@ -600,7 +600,7 @@ with fluid.scope_guard(inference_scope):
lab = numpy.argsort(results) lab = numpy.argsort(results)
# 打印 infer_3.png 这张图片的预测结果 # 打印 infer_3.png 这张图片的预测结果
img=Image.open('image/infer_3.png') img=Image.open(cur_dir + 'image/infer_3.png')
plt.imshow(img) plt.imshow(img)
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])
``` ```
......
...@@ -550,7 +550,7 @@ You can use trained model to classify handwriting pictures of digits. The progra ...@@ -550,7 +550,7 @@ You can use trained model to classify handwriting pictures of digits. The progra
### Generate input data to be inferred ### Generate input data to be inferred
`infer_3.png` is an example picture of number 3. Transform it into a numpy to match feed data format [infer_3.png](https://github.com/PaddlePaddle/book/blob/develop/02.recognize_digits/image/infer_3.png) is an example picture of number 3. Transform it into a numpy to match feed data format
```python ```python
...@@ -589,7 +589,7 @@ with fluid.scope_guard(inference_scope): ...@@ -589,7 +589,7 @@ with fluid.scope_guard(inference_scope):
lab = numpy.argsort(results) lab = numpy.argsort(results)
# Print prediction result of infer_3.png # Print prediction result of infer_3.png
img=Image.open('image/infer_3.png') img=Image.open(cur_dir + 'image/infer_3.png')
plt.imshow(img) plt.imshow(img)
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.
先完成此消息的编辑!
想要评论请 注册