Always getting value one for a binary classifier I'm using keras. I have one classification problem. The output should be either 0 or 1. I trained my model and I'm getting 86.59 accuracy. But when i check the predicted output what I'm seeing is all ones. I tried creating a categorical classifier with two nodes and tried the same. The test accuracy is 86.59% but when I check the output the prediction contains only one node with value one for the entire dataset. 

This is the code

from keras.models import Sequential

model = Sequential()
from keras.utils import to_categorical
y_traine = to_categorical(y_train)
y_teste = to_categorical(y_test)

from keras.layers import Dense
x_train = x_train.reshape(1300,64)
model.add(Dense(units=64, activation='relu', input_dim=64))
model.add(Dense(units=2, activation='softmax'))
model.compile(loss='categorical_crossentropy',
              optimizer='sgd',
              metrics=['accuracy'])
# x_train and y_train are Numpy arrays --just like in the Scikit-Learn API.
model.fit(x_train, y_traine, epochs=50, batch_size=32)
x_test = x_test.reshape(len(x_test),64)
loss_and_metrics = model.evaluate(x_test, y_teste, batch_size=128)
classes = model.predict(x_test, batch_size=128)
print (loss_and_metrics)
print (classes)


output

[0.32096896952051834, 0.875968992248062]

[[0.84422934 0.1557707 ]
 [0.8332991  0.16670085]
 [0.86778754 0.13221247]
 [0.9261704  0.07382962]
 [0.85143256 0.14856751]
 .
 .


What I'm doing wrong here? Why I'm getting training accuracy as 86% if my predictions are wrong?
Did you check how many samples are there for each class. I suspect imbalance class problem here. If you have majority of images with class=1. Classifier will be biased towards predicting everything as class 1. Try to balance your classes by either duplicating minor class images or deleting major class images.