Created
September 4, 2017 03:01
-
-
Save vrjkmr/28e52d395b3229c50d48825356283b66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample 1 | |
# Get 28x28 image | |
sample_1 = fashion_mnist.train.images[47].reshape(28,28) | |
# Get corresponding integer label from one-hot encoded data | |
sample_label_1 = np.where(fashion_mnist.train.labels[47] == 1)[0][0] | |
# Plot sample | |
print("y = {label_index} ({label})".format(label_index=sample_label_1, label=label_dict[sample_label_1])) | |
plt.imshow(sample_1, cmap='Greys') | |
# Sample 2 | |
# Get 28x28 image | |
sample_2 = fashion_mnist.train.images[23].reshape(28,28) | |
# Get corresponding integer label from one-hot encoded data | |
sample_label_2 = np.where(fashion_mnist.train.labels[23] == 1)[0][0] | |
# Plot sample | |
print("y = {label_index} ({label})".format(label_index=sample_label_2, label=label_dict[sample_label_2])) | |
plt.imshow(sample_2, cmap='Greys') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
KeyError Traceback (most recent call last)
in ()
8
9 # Plot sample
---> 10 print("y = {label_index} ({label})".format(label_index=sample_label_1, label=label_dict[sample_label_1]))
11 plt.imshow(sample_1, cmap='Greys')
12
KeyError: 4