-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jan
authored and
jan
committed
Apr 22, 2017
1 parent
90142b5
commit d01e85b
Showing
7 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Eigenfaces | ||
=========== | ||
|
||
Example for Principal Component Analysis (PCA) on face images also known as `Eigenfaces <https://en.wikipedia.org/wiki/Eigenface>`_ | ||
|
||
The code_ given below produces the following output. | ||
|
||
Some examples of the face images of the olivetti face dataset. | ||
|
||
.. figure:: images/example_faces.png | ||
:scale: 75 % | ||
:alt: Examples of the face datset | ||
|
||
The first 100 principal components extracted from the dataset. The components focus on characteristics like glasses, lighting direction, nose shape, ... | ||
|
||
.. image:: images/components_faces.png | ||
:scale: 75 % | ||
:alt: Principal components of teh face dataset | ||
|
||
The cumulative sum of the Eigenvalues show how 'compressable' the dataset is. | ||
|
||
.. image:: images/eigenspectrum_faces.png | ||
:scale: 50 % | ||
:alt: Eigenspectrum of the face dataset | ||
|
||
For example using only the first 50 Eigenvectors retains 87,5 % of the variance of the data and the reconstructed images look as follows. | ||
|
||
.. image:: images/reconstruction50.png | ||
:scale: 75 % | ||
:alt: Reconstruction using 50 PCs | ||
|
||
For 200 Eigenvectors we retain 98,0 % of the variance of the data and the reconstructed images look as follows. | ||
|
||
.. image:: images/reconstruction50.png | ||
:scale: 75 % | ||
:alt: Reconstruction using 200 PCs | ||
|
||
Comparing the results with the original images shows that the data can be compressed to 50 dimensions with an acceptable error. | ||
|
||
.. _code: | ||
|
||
Source code | ||
*********** | ||
|
||
.. figure:: images/download_icon.png | ||
:scale: 20 % | ||
:target: https://github.com/MelJan/PyDeep/blob/master/examples/eigenfaces.py | ||
|
||
.. literalinclude:: ../../examples/eigenfaces.py |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.