jeudi 28 janvier 2021

visulizing miss classified images from CNN

I am visualizing all misclassified images but I am getting the output. But the subplots are really small.

Below is my function. Can someone please help me with what mistake I am doing?.

def visualize_incorrect_labels(test_images, y_real, y_predicted):
    # INPUTS
    # aug_test_images      - images
    # aug_test_classes      - ground truth labels
    # Y_predicted - predicted label
    count = 0
    figure = plt.figure(figsize=(16, 16))
    incorrect_indices = (y_real != y_predicted)
    correct_indices = (y_real == y_predicted)
    y_real = y_real[incorrect_indices]
    y_predicted = y_predicted[incorrect_indices]
    test_images = test_images[incorrect_indices, :, :, :]
    for i, incorrect in enumerate(test_images[:]):
        plt.subplot(6, 3, i + 10)
        plt.imshow(aug_test_images[incorrect], cmap='gray', interpolation='none')
        plt.title("Predicted {}, Truth: {}".format(y_predicted[incorrect], y_real[incorrect]))
        plt.xticks([])
        plt.yticks([])
        plt.show()

Aucun commentaire:

Enregistrer un commentaire