Activity 3 - Displaying Clothing Samples
Workshop Resources
Display Samples
Now, you will be displaying all of your clothing samples by doing the following:
Copy the following code into your Colab notebook. This displays a collection of images along with their specific category.
plt.figure(figsize=(10,10)) #sets the image size to 10x10 inches
for i in range(25): #displays first 25 images with their class name
plt.subplot(5,5,i+1)
plt.xticks([])
plt.yticks([])
plt.grid(False)
plt.imshow(train_images[i], cmap=plt.cm.binary)
plt.xlabel(class_names[train_labels[i]])
plt.show() #shows images with their labels
Question 1
Your supervisor hands you out around 15-20 more clothing samples, which you will have to include in your program. Change the “for loop” so that there are 6 rows and 7 columns. How many images should you display?
Think about where you need to change the code to display this. The code currently displays 5 rows and 5 columns.