我有训练阶段和测试阶段的准确度层。我还试图训练Caffe形式PyCaffe,以便我可以更好地绘制曲线。但是我注意到,使用的返回精度
…
我在这里犯了一个错误! 一切都还可以,除了我应该只用test_iter次来划分积累的精度:
def run_test(solver, test_iter): ''' Tests the network on all test set and calculates the test accuracy ''' correct = 0 batch_size_test = solver.test_nets[0].blobs['data'].data.shape[0] for test_it in range(test_iter): #testing the network on all test set and calculate the test accuracy solver.test_nets[0].forward() correct += solver.test_nets[0].blobs['accuracy'].data acc = correct / test_iter return acc
片段:
solver.test_nets[0].blobs['accuracy'].data
将产生单个批次的准确性,显然为了获得整个测试集的准确性,需要累积它们 test_iter 时间,然后除以 test_iter 。
test_iter