Step 1: Download pca_exercise.zip, which contains 144x10000 of image data. Each column represents a 12x12 image block. First, you can see the following 200 images:
Step 2: Perform 0-means processing to ensure that the mean value of the data is 0 or close to 0.
Step 3: Run PCA to map original data to different feature vectors
Step 4: verify whether the above PCA calculation result is correct. If it is correct, the covariance of the ing data is a diagonal matrix. After visualizing this diagonal matrix, you can see a diagonal line in the rectangle chart with a different color from the background color:
Step 5: find out how many of the first principal components are suitable. Here, we need to retain at least 99% Difference values when using indicators.
Step 6: Dimensionality Reduction: based on the number of principal elements to be retained in the previous step
The above two images: The left side is the PCA data after dimensionality reduction, and the right side is the original data. We can visually see that except for the brightness, the difference is very small in other places.
Step 7: Add regularization items
After PCA and whitening are performed on the data, the diagonal element of the covariance matrix of the data is equal to 1. However, after the regularization parameter is added, all corner elements are less than 1:
The above two images: The normalization parameter is added on the left, and the regularization parameter is not added on the right.
Step 8: zca whitening:
The above two images: The left side is the data after zca whitening, and the right side is the original data. We can see that the edge is more prominent.
Image Processing for PAC and whitening exercises