提交 2214bc99 编写于 作者: W Wang,Jeff

Update the English Image Classification markdown

上级 34b152f7
...@@ -421,7 +421,7 @@ def load_image(file): ...@@ -421,7 +421,7 @@ def load_image(file):
im = im / 255.0 * 2.0 - 1.0 im = im / 255.0 * 2.0 - 1.0
return im return im
cur_dir = cur_dir = os.getcwd() cur_dir = os.getcwd()
img = load_image(cur_dir + '/image/infer_3.png') img = load_image(cur_dir + '/image/infer_3.png')
``` ```
......
...@@ -463,7 +463,7 @@ def load_image(file): ...@@ -463,7 +463,7 @@ def load_image(file):
im = im / 255.0 * 2.0 - 1.0 im = im / 255.0 * 2.0 - 1.0
return im return im
cur_dir = cur_dir = os.getcwd() cur_dir = os.getcwd()
img = load_image(cur_dir + '/image/infer_3.png') img = load_image(cur_dir + '/image/infer_3.png')
``` ```
......
此差异已折叠。
此差异已折叠。
...@@ -56,7 +56,7 @@ def train(use_cuda, train_program, params_dirname): ...@@ -56,7 +56,7 @@ def train(use_cuda, train_program, params_dirname):
def event_handler(event): def event_handler(event):
if isinstance(event, fluid.EndStepEvent): if isinstance(event, fluid.EndStepEvent):
if event.step % 100 == 0: if event.step % 100 == 0:
print("Pass %d, Batch %d, Cost %f, Acc %f" % print("\nPass %d, Batch %d, Cost %f, Acc %f" %
(event.step, event.epoch, event.metrics[0], (event.step, event.epoch, event.metrics[0],
event.metrics[1])) event.metrics[1]))
else: else:
...@@ -67,7 +67,8 @@ def train(use_cuda, train_program, params_dirname): ...@@ -67,7 +67,8 @@ def train(use_cuda, train_program, params_dirname):
avg_cost, accuracy = trainer.test( avg_cost, accuracy = trainer.test(
reader=test_reader, feed_order=['pixel', 'label']) reader=test_reader, feed_order=['pixel', 'label'])
print('Loss {0:2.2}, Acc {1:2.2}'.format(avg_cost, accuracy)) print('\nTest with Pass {0}, Loss {1:2.2}, Acc {2:2.2}'.format(
event.epoch, avg_cost, accuracy))
if params_dirname is not None: if params_dirname is not None:
trainer.save_params(params_dirname) trainer.save_params(params_dirname)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册