| |
Methods defined here:
- PLS(self)
- This implementation is based on the description of the algorithm by Herve
Abdi in the article "Partial Least Squares Regression and Projection on
Latent Structure Regression," Computational Statistics, 2010. From my
experiments with the different variants of PLS, this particular version
generates the best regression results. The Examples directory contains a
script that carries out head-pose estimation using this version of PLS.
- PLS1(self)
- This implementation is based on the description of the algorithm in the article
"Overview and Recent Advances in Partial Least Squares" by Roman Rosipal and
Nicole Kramer, LNCS, 2006. Note that PLS1 assumes that the Y matrix consists
of just one column. That makes it particularly appropriate for solving face
recognition problems. This module uses this method for a two-class
discrimination between the faces. We construct the X and Y matrices from the
positive and the negative examples of the face to be recognized. Each row of
the X matrix consists of the vectorized representation of either a positive
example of a face or a negative example. The corresponding element in the
one-column Y is +1 for the positive examples and -1 for the negative
examples.
- PLS2(self)
- This implementation is based on the description of the algorithm in the article
"Overview and Recent Advances in Partial Least Squares" by Roman Rosipal and
Nicole Kramer, LNCS, 2006. Unlike PLS1, this implementation places no
constraints on the number of columns in the Y matrix.
- __init__(self, *args, **kwargs)
- apply_regression_matrix_interactively_to_one_row_of_X_to_get_one_row_of_Y(self)
- extract_pixels_from_image(self, imagename)
- get_XMatrix_from_csv(self)
- If you wish to use your own X and Y matrices for PLS regression, you'd need
to supply them in the form of CSV files. This method extracts the X
matrix from the file named for this purpose by the constructor option
XMatrix_file.
- get_YMatrix_from_csv(self)
- If you wish to use your own X and Y matrices for PLS regression, you'd need
to supply them in the form of CSV files. This method extracts the Y
matrix from the file named for this purpose by the constructor option
YMatrix_file.
- run_evaluation_of_PLS_regression_for_face_recognition(self)
- The docstring associated with the method
vectorize_images_and_construct_X_and_Y_matrices_for_face_recognition_with_PLS1()
applies here also. The method here uses the Xtest and Yest matrices
constructed by the `vectorize' method named above from the images in the
`testing/positives' and the /testing/negatives/ subdirectories for evaluating
PLS regression for face recognition.
- run_evaluation_of_PLS_regression_for_head_pose_estimation(self)
- The docstring associated with the method
vectorize_images_and_construct_X_and_Y_matrices_for_head_pose_estimation_with_PLS()
applies here also. The method here uses the Xtest and Yest matrices
constructed by the `vectorize' method named above from the images in the
`testing' directory for evaluating PLS regression for head pose estimation.
- vectorize_images_and_construct_X_and_Y_matrices_for_face_recognition_with_PLS1(self)
- This method assumes that the images to be used for training and testing are
organized as follows in the image_directory option supplied to the
constructor of the module:
image_directory
|
|
--------------------------------------
| |
| |
training testing
| |
| |
------------------------- -----------------------------
| | | |
| | | |
positives negatives positives negatives
The module constructs the X and the Y matrices from the images in the
`training/positives' and the `training/negatives' subdirectories. The
vectorized representation of each image constitutes a row of the X
matrix. The corresponding element in the one-column Y matrix is +1 for the
images in the `positives' directory and -1 for the images in the `negatives'
directory. In a similar manner, the method constructs Xtest and Ytest
matrices from the images in the `testing/positives' and `testing/negatives'
subdirectories.
- vectorize_images_and_construct_X_and_Y_matrices_for_head_pose_estimation_with_PLS(self)
- This method assumes that the image directory contains two subdirectories named:
-- training
-- testing
Furthermore, the method assumes that the name of each image file in the two
subdirectories named above is an encoding of the roll, pitch, and yaw values
associated with the face image in that image. For example, the name of the
first image file in the directory `/head_pose_images/training/' is
y1p1r2.jpg
This name implies that the pose of the head in this image corresponds to the
following values for roll, pitch, and yaw:
yaw = -30 degrees
pitch = -30 degrees
roll = -20 degrees
To understand why the name of the file translates into the values shown
above, note that the pose of the head is varied with respect to each of the
roll, pitch, and yaw parameters from -30 degrees to +30 degrees. We use the
following mapping between the integer indices associated with the parameters
in the file names and their actual angles:
1 => -30 deg
2 => -20 deg
3 => -10 deg
4 => 0 deg
5 => +10 deg
6 => +20 deg
7 => +30 deg
This naming convention makes it easy to to create the rows of the Y matrix
for each row of the X matrix. Each row of the X matrix is the vectorized
representation of the pixels in the image and each corresponding row of the
Y matrix consists of the three pose angles associated with that image.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|