title: More than one prediction in multi-classification in Keras?
body: <p>I am learning about designing Convolutional Neural Networks using Keras. I have developed a simple model using VGG16 as the base. I have about 6 classes of images in the dataset. Here are the code and description of my model.</p>
  
  <pre><code>model = models.Sequential()
  conv_base = VGG16(weights='imagenet' ,include_top=False, input_shape=(IMAGE_SIZE, IMAGE_SIZE, 3))
  conv_base.trainable = False
  model.add(conv_base)
  model.add(layers.Flatten())
  model.add(layers.Dense(256, activation='relu', kernel_regularizer=regularizers.l2(0.001)))
  model.add(layers.Dropout(0.5))
  model.add(layers.Dense(6, activation='sigmoid'))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/EcQ8E.png" alt="1"></p>
  
  <p>Here is the code for compiling and fitting the model:</p>
  
  <pre><code>model.compile(loss='categorical_crossentropy',
          optimizer=optimizers.RMSprop(lr=1e-4),
           metrics=['acc'])
  model.summary()
  
  callbacks = [
      EarlyStopping(monitor='acc', patience=1, mode='auto'),
      ModelCheckpoint(monitor='val_loss', save_best_only=True, filepath=model_file_path)
  ]
  
  history = model.fit_generator(
      train_generator,
      steps_per_epoch=10,
      epochs=EPOCHS,
      validation_data=validation_generator,
      callbacks = callbacks,
      validation_steps=10)
  </code></pre>
  
  <p>Here is the code for prediction of a new image</p>
  
  <pre><code>img = image.load_img(img_path, target_size=(IMAGE_SIZE, IMAGE_SIZE))
  plt.figure(index)
  imgplot = plt.imshow(img)
  
  x = image.img_to_array(img)
  x = x.reshape((1,) + x.shape)
  prediction = model.predict(x)[0]
  # print(prediction)
  </code></pre>
  
  <p>Often model.predict() method predicts more than one class. </p>
  
  <pre><code>[0 1 1 0 0 0]
  </code></pre>
  
  <p>I have a couple of questions</p>
  
  <ol>
  <li>Is it normal for a multiclass classification model to predict more than one output?</li>
  <li>How is accuracy measured during training time if more than one class was predicted?</li>
  <li>How can I modify the neural network so that only one class is predicted?</li>
  </ol>
  
  <p>Any help is appreciated. Thank you so much!</p>