Error in visualizing the predictions

neural_network
python

#1

in the To test our model with our own eyes, let’s visualize its predictions part I am always getting prediction is: 0

img_name = rng.choice(test.filename)
filepath = os.path.join(data_dir,'Train','Images','test',img_name)
img = imread(filepath, flatten = True)
test_index = int(img_name.split('.')[0]) - 49000
print ("Prediction is: {}".format(pred[test_index])) 
pylab.imshow(img,cmap = 'gray') 
pylab.show()

How do i solve it?


#2

Hi @klaptor,

Make sure you are giving the correct path for the image while reading it.


#3

I did check it. The path is correct. Still i am getting prediction is: 0


#4

Hi @klaptor,

The model might not have been trained properly. You can try to increase the number of epochs while training it.