Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fig, axes = plt.subplots(nrows=10, ncols=5, figsize=(7, 14))
- fig.suptitle("Po 5 przykładowych obrazów z każdej klasy MNIST", fontsize=14)
- rng = np.random.default_rng()
- for digit in range(10):
- idxs = np.where(y_train == digit)[0]
- chosen = rng.choice(idxs, size=5, replace=False)
- for col, img_idx in enumerate(chosen):
- ax = axes[digit, col]
- ax.imshow(x_train[img_idx], cmap="gray")
- ax.axis("off")
- plt.show()
Add Comment
Please, Sign In to add comment