From 7a035425b30db69d4776e804aa91ae910ae5d2ed Mon Sep 17 00:00:00 2001
From: Neta Zmora <neta.zmora@intel.com>
Date: Thu, 31 Oct 2019 11:27:36 +0200
Subject: [PATCH] apputils/image_classifier.py: fix log of best score

The number of nnz (non-zero) parameters in the model is printed as a
negative number.  Fix this issue and also change the label of this
field in the log, to better reflect what this value means.
---
 distiller/apputils/image_classifier.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/distiller/apputils/image_classifier.py b/distiller/apputils/image_classifier.py
index abc1567..47287fc 100755
--- a/distiller/apputils/image_classifier.py
+++ b/distiller/apputils/image_classifier.py
@@ -732,8 +732,8 @@ def update_training_scores_history(perf_scores_history, model, top1, top5, epoch
     # Sort by sparsity as main sort key, then sort by top1, top5 and epoch
     perf_scores_history.sort(key=operator.attrgetter('params_nnz_cnt', 'top1', 'top5', 'epoch'), reverse=True)
     for score in perf_scores_history[:num_best_scores]:
-        msglogger.info('==> Best [Top1: %.3f   Top5: %.3f   Sparsity:%.2f   Params: %d on epoch: %d]',
-                       score.top1, score.top5, score.sparsity, score.params_nnz_cnt, score.epoch)
+        msglogger.info('==> Best [Top1: %.3f   Top5: %.3f   Sparsity:%.2f   NNZ-Params: %d on epoch: %d]',
+                       score.top1, score.top5, score.sparsity, -score.params_nnz_cnt, score.epoch)
 
 
 def earlyexit_loss(output, target, criterion, args):
-- 
GitLab