In [2]:
%pylab inline
In [3]:
path = "/PATH/lfw/Aaron_Eckhart/Aaron_Eckhart_0001.jpg"
ae = imread(path)
imshow(ae)
Out[3]:
In [5]:
tmpPath = "/tmp/aeGray.jpg"
aeGary = imread(tmpPath)
imshow(aeGary, cmap=plt.cm.gray)
Out[5]:
In [7]:
pc = np.loadtxt("/tmp/pc.csv", delimiter=",")
print(pc.shape)
In [8]:
def plot_gallery(images, h, w, n_row=2, n_col=5):
"""Helper function to plot a gallery of portraits"""
plt.figure(figsize=(1.8 * n_col, 2.4 * n_row))
plt.subplots_adjust(bottom=0, left=.01, right=.99, top=.90, hspace=.35)
for i in range(n_row * n_col):
plt.subplot(n_row, n_col, i + 1)
plt.imshow(images[:, i].reshape((h, w)), cmap=plt.cm.gray)
plt.title("Eigenface %d" % (i + 1), size=12)
plt.xticks(())
plt.yticks(())
In [9]:
plot_gallery(pc, 50, 50)
In [19]:
s = np.loadtxt("/tmp/s.csv", delimiter=",")
print(s.shape)
plot(s)
Out[19]:
In [23]:
plot(cumsum(s))
plt.yscale('log')