title: How to get probability of each class instead of one hot encoded array with one value 1 and others 0?
body: <p>My Sequential CNN model is trained on 39 classes as a multi-class classifier. As for predictions, it returns a one-hot encoded array like <code>[0,0,...1,0,...]</code> whereas I want something like <code>[0.012,0.022,0.067,...,0.997,0.0004,...]</code></p>
  
  <p>Is there a way to get this? if not what exactly should I make to get these? </p>
  
  <p>The reason I want it this way is to verify how close are other classes, so if one says 0.98 and others say 0.96 then I am doing something wrong, data isn't enough, etc..</p>
  
  <p>Thank you :)</p>
  
  <p>My model is basically a keras.model resnet50 with following configs : </p>
  
  <pre><code>model = keras.applications.resnet.ResNet50(include_top=False, weights=None, input_tensor=None, input_shape=(64,64,1), pooling='avg', classes=39)
  
  x = model.output
  x = Dropout(0.7)(x)
  num_classes = 39
  predictions = Dense(num_classes, activation= 'softmax')(x)
  model = Model(inputs = model.input, outputs = predictions)
  
  optimizer = keras.optimizers.Adam(learning_rate=0.001, beta_1=0.9, beta_2=0.999, amsgrad=False)
  model.compile(optimizer, loss='categorical_crossentropy', metrics=['categorical_accuracy'], loss_weights=None, sample_weight_mode=None, weighted_metrics=None, target_tensors=None)
  
  </code></pre>
  
  <p>Sample input :</p>
  
  <pre><code>import cv2
  img = cv2.imread(IMAGE_PATH, 0)
  img = cv2.resize(img, (64,64))
  img = np.reshape(img, (1,64,64,1))
  predicted_class_indices = np.argmax(model.predict(img, verbose = 1))
  </code></pre>
  
  <p>Sample output:</p>
  
  <pre><code>array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0., 0.]], dtype=float32)
  </code></pre>
  
  <p>Desired output (numbers are hypothetical):</p>
  
  <pre><code>array([[0.022, 0.353, 0.0535, 0.52, 0212., 0.822, 0.532, 0., 0., 0., 0., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.,
          0., 0., 0., 0., 0., 0., 0.]], dtype=float32)
  </code></pre>