Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left

  Apply Now

Project - Building Cat vs Non-Cat Image Classifier using NumPy and ANN

10 / 32

Cat vs Non-cat Classifier - Visualize the Data

The classes of the images in the datasets are cat and non-cat. These labels of each sample are stored in train_set_y_orig, validation_y and test_set_y, where 1 means 'cat' and 0 means 'non-cat'. Let us see how to get this info Pythonically:

INSTRUCTIONS

The following code gets the classes from the data set. We will be printing the classes, how the labels of the classes are stored in the data set. Then, we will be plotting the image.

Copy-paste the following code.

classes = np.array(test_dataset["list_classes"][:])

print("Classes are: ",classes)
print("Groundtruth stored as: ",train_set_y_orig[2])
print(classes[train_set_y_orig[2]].decode('utf-8'))

plt.imshow(train_set_x_orig[2])
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...