Introduction

Datasets

Visit link http://deeplearning.net/datasets/ for a list of datasets of different types.

Preprocessing image datasets


In [1]:
import numpy as np
import matplotlib.pyplot as plt

In [2]:
plt.style.use('ggplot')

In [14]:
from libs import utils

In [35]:
#files is the list of files in the img_align_celeba directory
files = utils.get_celeb_files()
image = plt.imread(files[50])
plt.imshow(image)
plt.show()

In [17]:
def get_celeb_imgs(files):
    return [plt.imread(file) for file in files]

In [43]:
imgs = get_celeb_imgs(files[0:100])

In [49]:
# Give a tensor of all images
data = np.array(imgs)
print type(data[0, 0, 0, 0])


<type 'numpy.uint8'>

In [47]:
plt.imshow(np.mean(data, axis = 0).astype(np.uint8))
plt.show()

In [ ]: