In [1]:
# !python3 -m pip install imageio
In [2]:
from datetime import datetime
from IPython.display import Image
import matplotlib.pyplot as plt
import numpy as np
from imageio import imread
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
import torchvision
from torchvision import datasets, transforms
from torchvision.utils import save_image
from tqdm import tqdm

Sample Images

Image shape is (218,178,3).
202,599 images.

In [3]:
n_images = 202599
start = np.random.randint(1, n_images-20)
FOLDER = 'img_align_celeba/0/'
FILES = ["{}{:06}.jpg".format(FOLDER, i) for i in range(start+1, start+21)]

scale = 0.8
fig, axs = plt.subplots(2, 5, figsize=(scale*20,scale*10))
for i, ax in enumerate(axs.flatten()):
    img = imread(FILES[i])
    ax.imshow(imread(FILES[i]))
    ax.set_xticks([])
    ax.set_yticks([])
    ax.set_aspect('equal')

plt.subplots_adjust(wspace=0, hspace=0)
plt.show()