def display_results(image_paths, probs):
 with open('imagenet-classes.txt', 'rb') as infile:
  class_labels = map(str.strip, infile.readlines())
 class_indices = np.argmax(probs, axis=1)
 print '\n{:20} {:30} {}'.format('Image', 'Classified As', 'Confidence')
 print ('-' * 70)
 for (img_idx, image_path) in enumerate(image_paths):
  img_name = osp.basename(image_path)
  class_name = class_labels[class_indices[img_idx]]
  confidence = round((probs[(img_idx, class_indices[img_idx])] * 100), 2)
  print '{:20} {:30} {} %'.format(img_name, class_name, confidence)

def display_results ( image_paths , probs ) : with open ( 'imagenet-classes.txt' , 'rb' ) as infile : class_labels = map ( str . strip , infile . readlines ( ) ) class_indices = np . argmax ( probs , axis = 1 ) print '\n{:20} {:30} {}' . format ( 'Image' , 'Classified As' , 'Confidence' ) print ( '-' * 70 ) for ( img_idx , image_path ) in enumerate ( image_paths ) : img_name = osp . basename ( image_path ) class_name = class_labels [ class_indices [ img_idx ] ] confidence = round ( ( probs [ ( img_idx , class_indices [ img_idx ] ) ] * 100 ) , 2 ) print '{:20} {:30} {} %' . format ( img_name , class_name , confidence )
displays the classification results given the class probability for each image .