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

32 / 32

Cat vs Non-cat Classifier - Example of Misclassified image

Let us just have a look at some of the correctly classified and misclassified samples by our model.

Note:

Write each of the 4 code blocks mentioned below in different code-cells of your jupyter notebook. This would help you understand and visualize better.

INSTRUCTIONS

Correctly Classified Images:

  • Plot the image of a correctly classified cat image using matplotlib.

    num_px = train_set_x_orig.shape[1]
    plt.imshow(test_set_x[:,1].reshape((num_px, num_px, 3)))
    predicted_value = Y_prediction_test[0][1]
    print("Predicted as:",classes[int(predicted_value)].decode('utf-8'))
    predicted_value
    
  • Plot the image of a correctly classified non-cat image using matplotlib.

    num_px = train_set_x_orig.shape[1]
    plt.imshow(test_set_x[:,2].reshape((num_px, num_px, 3)))
    predicted_value = Y_prediction_test[0][2]
    print("Predicted as:",classes[int(predicted_value)].decode('utf-8'))
    predicted_value
    

Incorrectly Classified Images:

  • Plot the image of an incorrectly classified cat image using matplotlib.

    num_px = train_set_x_orig.shape[1]
    plt.imshow(test_set_x[:,3].reshape((num_px, num_px, 3)))
    predicted_value = Y_prediction_test[0][3]
    print("Predicted as:",classes[int(predicted_value)].decode('utf-8'))
    predicted_value
    
  • Plot the image of an incorrectly classified non-cat image using matplotlib.

    num_px = train_set_x_orig.shape[1]
    plt.imshow(test_set_x[:,4].reshape((num_px, num_px, 3)))
    predicted_value = Y_prediction_test[0][4]
    print("Predicted as:",classes[int(predicted_value)].decode('utf-8'))
    predicted_value
    
Get Hint See Answer


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

Loading comments...