Skip to content

Commit

Permalink
加入说明
Browse files Browse the repository at this point in the history
  • Loading branch information
lawlite19 committed Apr 6, 2017
1 parent 3cc5733 commit 717dabb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
Expand Up @@ -170,7 +170,7 @@ def cls_accuracy(correct):
def validation_accuracy():
correct, _ = predict_cls_validation()
return cls_accuracy(correct)
'''define a function to'''
'''define a function to calculate test acc'''
def print_test_accuracy(show_example_errors=False,
show_confusion_matrix=False):
correct, cls_pred = predict_cls_test()
Expand Down Expand Up @@ -204,14 +204,14 @@ def plot_conv_weights(weights, input_channel=0):
ax.set_xticks([])
ax.set_yticks([])
plt.show()
#print_test_accuracy()
#plot_conv_weights(weights=weights_conv1)
#optimize(10000)
#print_test_accuracy(show_example_errors=True,
#show_confusion_matrix=True)
#plot_conv_weights(weights=weights_conv1)
'''restore the variables that saved on disk'''
saver.restore(sess=session, save_path=save_path)
print_test_accuracy(True, True)
print_test_accuracy()
plot_conv_weights(weights=weights_conv1)
optimize(10000)
print_test_accuracy(show_example_errors=True,
show_confusion_matrix=True)
plot_conv_weights(weights=weights_conv1)
#'''restore the variables that saved on disk'''
#saver.restore(sess=session, save_path=save_path)
#print_test_accuracy(True, True)


Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions readme.md
Expand Up @@ -1345,6 +1345,30 @@ def optimize(num_iterations):
time_diff = end_time-start_time
print("Time usage:" + str(timedelta(seconds=int(round(time_diff)))))
```
- 调用`optimize(10000)`输出信息

``` stylus
Iter: 5100, Train_batch accuracy:100.0%, validation acc: 98.8% *
Iter: 5200, Train_batch accuracy:100.0%, validation acc: 98.3%
Iter: 5300, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 5400, Train_batch accuracy: 98.4%, validation acc: 98.6%
Iter: 5500, Train_batch accuracy: 98.4%, validation acc: 98.6%
Iter: 5600, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 5700, Train_batch accuracy: 96.9%, validation acc: 98.9% *
Iter: 5800, Train_batch accuracy:100.0%, validation acc: 98.6%
Iter: 5900, Train_batch accuracy:100.0%, validation acc: 98.6%
Iter: 6000, Train_batch accuracy: 98.4%, validation acc: 98.7%
Iter: 6100, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 6200, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 6300, Train_batch accuracy: 98.4%, validation acc: 98.8%
Iter: 6400, Train_batch accuracy: 98.4%, validation acc: 98.8%
Iter: 6500, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 6600, Train_batch accuracy:100.0%, validation acc: 98.7%
Iter: 6700, Train_batch accuracy:100.0%, validation acc: 98.8%
No improvement found in a while, stop running
Time usage:0:18:43
```
可以看到最后10次输出(没100次输出一次)在验证集上准确度都没有提高,直接保存

### 3、 小批量预测并计算准确率
- 因为需要预测**测试集和验证集**,这里参数指定需要的images
Expand Down

0 comments on commit 717dabb

Please sign in to comment.