Tuesday, 17 September 2019

neural network 4

#pycharm
#print output neurons of the first prediction which are the probability of each of the 10 categories

prediction = model.predict(test_images)
print(prediction[0])

--------------------------------------
#logs
#the last category is what AI thinks the category that the wear most likely belongs to

[3.4543206e-07 1.4980142e-09 1.3186813e-07 2.5887127e-08 1.9471056e-08
 4.6815544e-02 1.1219876e-05 1.2661220e-02 9.5906926e-06 9.4050187e-01]

------------------------------------------------------------------
#pycharm
#print the first 5 test images with the actual category and the category that AI thinks most likely

for i in range(5):
    plt.grid(False)
    plt.imshow(test_images[i], cmap=plt.cm.binary)
    plt.xlabel('actual: ' + class_names[test_labels[i]])
    plt.title('prediction: ' + class_names[np.argmax(prediction[i])])
    plt.show()

-------------------------------
#matplotlib
#AI guessed all right, images make sense to be in the predicted category







reference:
http://chuanshuoge2.blogspot.com/2019/09/neural-network-3.html
https://www.youtube.com/watch?v=RqLD1INA_cQ

No comments:

Post a Comment