Created
January 28, 2019 07:54
-
-
Save afozbek/285477fa587ac7c8126ea65831a419ea to your computer and use it in GitHub Desktop.
medium
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
num_of_samples = [] | |
cols = 5 #We will select 5 random images | |
num_of_classes = 10 #each digit total: 10 | |
fig, axs = plt.subplots(nrows=num_of_classes, ncols=cols, | |
figsize=(5, 10)) | |
fig.tight_layout() | |
for i in range(cols): | |
for j in range(num_of_classes): | |
x_selected = X_train[y_train == j] | |
axs[j][i].imshow(x_selected[random.randint(0, len(x_selected -1)), | |
:, :], | |
cmap=plt.get_cmap('gray')) | |
axs[j][i].axis("off") | |
if i==2: | |
axs[j][i].set_title(str(j)) | |
num_of_samples.append(len(x_selected)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment