@@ -218,22 +218,17 @@ def validate(args):
218218 loss = losses , top1 = top1 , top5 = top5 ))
219219
220220 if real_labels is not None :
221- real_top1 = real_labels .get_accuracy (k = 1 )
222- real_top5 = real_labels .get_accuracy (k = 5 )
223- results = OrderedDict (
224- top1 = round (real_top1 , 4 ), top1_err = round (100 - real_top1 , 4 ),
225- top5 = round (real_top5 , 4 ), top5_err = round (100 - real_top5 , 4 ),
226- top1_original = round (top1 .avg , 4 ),
227- top5_original = round (top5 .avg , 4 ))
221+ # real labels mode replaces topk values at the end
222+ top1a , top5a = real_labels .get_accuracy (k = 1 ), real_labels .get_accuracy (k = 5 )
228223 else :
229- results = OrderedDict (
230- top1 = round ( top1 . avg , 4 ), top1_err = round ( 100 - top1 . avg , 4 ),
231- top5 = round (top5 . avg , 4 ), top5_err = round (100 - top5 . avg , 4 ))
232- results . update ( OrderedDict (
224+ top1a , top5a = top1 . avg , top5 . avg
225+ results = OrderedDict (
226+ top1 = round (top1a , 4 ), top1_err = round (100 - top1a , 4 ),
227+ top5 = round ( top5a , 4 ), top5_err = round ( 100 - top5a , 4 ),
233228 param_count = round (param_count / 1e6 , 2 ),
234229 img_size = data_config ['input_size' ][- 1 ],
235230 cropt_pct = crop_pct ,
236- interpolation = data_config ['interpolation' ]))
231+ interpolation = data_config ['interpolation' ])
237232
238233 _logger .info (' * Acc@1 {:.3f} ({:.3f}) Acc@5 {:.3f} ({:.3f})' .format (
239234 results ['top1' ], results ['top1_err' ], results ['top5' ], results ['top5_err' ]))
0 commit comments