WwYc commited on
Commit
f265ee4
·
verified ·
1 Parent(s): b1e91f4

Update visualization.py

Browse files
Files changed (1) hide show
  1. visualization.py +5 -5
visualization.py CHANGED
@@ -66,9 +66,9 @@ def print_top_classes(original_image, **kwargs):
66
  if len(CLS2IDX[cls_idx]) > max_str_len:
67
  max_str_len = len(CLS2IDX[cls_idx])
68
 
69
- print('Top 5 classes:')
70
  for cls_idx in class_indices:
71
- output_string = '\t{} : {}'.format(cls_idx, CLS2IDX[cls_idx])
72
- output_string += ' ' * (max_str_len - len(CLS2IDX[cls_idx])) + '\t\t'
73
- output_string += 'value = {:.3f}\t prob = {:.1f}%'.format(predictions[0, cls_idx], 100 * prob[0, cls_idx])
74
- print(output_string)
 
 
66
  if len(CLS2IDX[cls_idx]) > max_str_len:
67
  max_str_len = len(CLS2IDX[cls_idx])
68
 
 
69
  for cls_idx in class_indices:
70
+ output_string = '{} : {}'.format(cls_idx, CLS2IDX[cls_idx])
71
+ # output_string += ' ' * (max_str_len - len(CLS2IDX[cls_idx])) + '\t\t'
72
+ output_string += 'value = {:.3f} prob = {:.1f}%'.format(predictions[0, cls_idx], 100 * prob[0, cls_idx])
73
+ output.append(output_string)
74
+ return output