[V2 inteface]The prediction result is not consistent with training error
Created by: wanglovesyang
I tried multi-class image classification using resnet on a toy dataset of 6 images. Since the motivation is to test the v2 interface, the validation set is set to the training set. A paddle.infer was called right after the model is trained so as to export the prediction result of each training example.
However, while on the iterations, the training error and test error are not always consistent. The log goes:
========================================================== Pass 0, Batch 0, Cost 1.237619, {'classification_error_evaluator': 1.0}
Test with Pass 0, {'classification_error_evaluator': 0.6666666865348816}
Pass 1, Batch 0, Cost 24.659233, {'classification_error_evaluator': 0.6666666865348816}
Test with Pass 1, {'classification_error_evaluator': 0.6666666865348816}
Pass 2, Batch 0, Cost 22.535332, {'classification_error_evaluator': 0.5}
Test with Pass 2, {'classification_error_evaluator': 0.6666666865348816}
Pass 3, Batch 0, Cost 42.666667, {'classification_error_evaluator': 0.6666666865348816}
Test with Pass 3, {'classification_error_evaluator': 0.3333333432674408}
Pass 4, Batch 0, Cost 8.351775, {'classification_error_evaluator': 0.3333333432674408}
Test with Pass 4, {'classification_error_evaluator': 0.6666666865348816}
Pass 5, Batch 0, Cost 0.000000, {'classification_error_evaluator': 0.0}
Test with Pass 5, {'classification_error_evaluator': 0.3333333432674408}
Pass 6, Batch 0, Cost 0.000000, {'classification_error_evaluator': 0.0}
Test with Pass 6, {'classification_error_evaluator': 0.1666666716337204}
Pass 7, Batch 0, Cost 0.000000, {'classification_error_evaluator': 0.0}
Test with Pass 7, {'classification_error_evaluator': 0.1666666716337204}
Pass 8, Batch 0, Cost 0.000000, {'classification_error_evaluator': 0.0}
Test with Pass 8, {'classification_error_evaluator': 0.0}
Pass 9, Batch 0, Cost 0.000000, {'classification_error_evaluator': 0.0}
At the same time, the prediction result appears to be so bad while the model has converged to an error of 0.
lablel: 1, [ 1.60374654e-28 9.99959826e-01 4.01607758e-05] lablel: 1, [ 1.96379697e-04 9.99085784e-01 7.17833987e-04] lablel: 2, [ 0.37570101 0.60602868 0.0182703 ] lablel: 2, [ 1.60379637e-28 9.99990940e-01 9.09937262e-06] lablel: 0, [ 1.60379637e-28 9.99990940e-01 9.09937262e-06] lablel: 0, [ 0.39177549 0.593431 0.01479354]
the code and test data is available at http://pan.baidu.com/s/1jHZW89w