Prediction

Now we will use model.predict() to get the prediction. It will return an array of size 10, consisting of the labels’ probabilities. The max probability of the label will be the answer.

Python3




# There are 10 output labels for the
# Fashion MNIST dataset
labels = ['t_shirt', 'trouser', 'pullover',
          'dress', 'coat', 'sandal', 'shirt',
          'sneaker', 'bag', 'ankle_boots']
 
# Make a prediction
predictions = model.predict(testX[:1])
label = labels[np.argmax(predictions)]
 
print(label)
plt.imshow(testX[:1][0])
plt.show()


Output:

 



Build the Model for Fashion MNIST dataset Using TensorFlow in Python

The primary objective will be to build a classification model which will be able to identify the different categories of the fashion industry from the Fashion MNIST dataset using Tensorflow and Keras

To complete our objective, we will create a CNN model to identify the image categories and train it on the dataset. We are using deep learning as a method of choice since the dataset consists of images, and CNN’s have been the choice of algorithm for image classification tasks. We will use Keras to create CNN and Tensorflow for data manipulation tasks.

The task will be divided into three steps data analysis, model training and prediction. Let us start with data analysis.

Similar Reads

Data Analysis

Step 1: Importing the required libraries...

Model training

...

Prediction

...

Contact Us