title: Image classification in python getting not accurate prediction
body: <p>I am learning image classification with tensorflow. Below is my program . for same test image if i am passing again and again it gives sometimes different  labels . It is not predicting correctly</p>
  <pre><code>import tensorflow as tf
  import numpy as np
  import os
  from keras.models import Sequential
  from keras.layers.core import Dense, Dropout, Flatten,Activation
  from keras.layers.convolutional import Conv2D, MaxPooling2D
  from keras.constraints import maxnorm
  from keras.utils import np_utils
  
  
  
  classifier = Sequential()
  classifier.add(Conv2D(32, (3, 3), input_shape = (64,64,3 ),activation=&quot;relu&quot;))
  classifier.add(MaxPooling2D(pool_size = (2,2)))
  classifier.add(Flatten())
  
  classifier.add(Dense(128 , kernel_initializer ='uniform' , activation = 'relu')) 
  classifier.add(Dense(10 , kernel_initializer ='uniform' , activation = 'softmax'))
  
  classifier.compile(optimizer = 'rmsprop', loss = 'categorical_crossentropy' , metrics = ['accuracy']) 
  
  
  from keras_preprocessing.image import ImageDataGenerator
  
  train_datagen = ImageDataGenerator(
          rescale=1./255,
          shear_range=0.2,
          zoom_range=0.2,
          horizontal_flip=True)
  
  test_datagen = ImageDataGenerator(rescale=1./255)
  
  training_set = train_datagen.flow_from_directory(
          '/code/train',
          shuffle=True,
          target_size=(64,64),
          batch_size=5,
          class_mode='categorical',
          classes=[&quot;shiv&quot;, &quot;kart&quot;, &quot;nall&quot;,&quot;surendra&quot;,&quot;harshi&quot;,&quot;nag&quot;,&quot;saura&quot;,&quot;rajan&quot;,&quot;manoj&quot;,&quot;abhimanyu&quot;])
  
  test_set = test_datagen.flow_from_directory(
          '/code/validation',
          shuffle=True,
          target_size=(64,64),
          batch_size=5,
          class_mode='categorical',
          classes=[&quot;shiv&quot;, &quot;kart&quot;, &quot;nall&quot;,&quot;surendra&quot;,&quot;harshi&quot;,&quot;nag&quot;,&quot;saura&quot;,&quot;rajan&quot;,&quot;manoj&quot;,&quot;abhimanyu&quot;])
  
  from IPython.display import display
  from PIL import Image
  
  classifier.fit(
          training_set,
          steps_per_epoch=80,
          epochs=12,
          validation_data=test_set,
          validation_steps=100)
  
  
      from keras_preprocessing import image
      files_dir = '/code/test_image_clasification1'
      files = os.listdir(files_dir)
      np.set_printoptions(precision=3)
      for f in files:
          image_path = files_dir + '/' + f
          test_image = image.load_img(image_path,target_size = (64, 64))
          test_image = image.img_to_array(test_image)
          test_image = np.expand_dims(test_image, axis = 0)
          result = classifier.predict(test_image)
          #classes = classifier.predict_classes(test_image)
          #print (classes)
          labels = [&quot;shivaji&quot;,&quot;kartik&quot;,&quot;nallayan&quot;,&quot;surendar&quot;,&quot;harshita&quot;,&quot;nagendar&quot;,&quot;saurabh&quot;,&quot;rajan&quot;,&quot;manoj&quot;,&quot;abhimanyu&quot;]
      indx = np.argmax(result)
      #score = np.argmax(np.round(result*100,2))
      #print(np.round(result,2))
      match_percentage=np.max(result)
      match_class=labels[indx]
      
      print(&quot;the image &quot; + f + &quot; is matching with &quot;+ match_class + &quot; having matching percentage  &quot; +&quot;{:.2%}&quot;.format(match_percentage) )
      #print(list(zip(labels,result)))
       #print(f,labelsindx])
  </code></pre>
  <p>Can any one help me if anything wrong in model training . For information, i have 122 image in train set and 48 in validation set.</p>