Assignment Task
Introduction
Image processing, data compression, and signal analysis are just a few of the many applications of linear algebra’s Singular Value Decomposition (SVD). When applied to the photos in the Yale Face Database, SVD analysis becomes a potent tool for deducing the images’ intrinsic structure and extracting useful features for further usage in things like image reconstruction, recognition, and analysis.
Question 1:
To address Question 1, which analysis of the performing Singular Value Decomposition (SVD) and visualizes the results on the Yale Faces B dataset images.
- Converting Images to Flattened Matrix: The code starts by converting the cell array of images into a 2D matrix (Hu et al., 2017). It calculates the necessary dimensions based on the number of rows and columns in the original image array. It also determines the dimensions of each image in terms of height and width.
- Initializing Flattened Image Matrix: An empty matrix named flattened_images is initialized to store the flattened version of each image. Each column in this matrix will represent a flattened image.
- Flattening Images and Storing in Matrix: Using nested loops, the code iterates through each cell in the images array, flattens the image, and stores the flattened image vector as a column in the flattened images matrix. This process effectively vectorizes the images for subsequent analysis.
- Performing Singular Value Decomposition (SVD): The SVD is performed on the flattened images matrix using the svd function with the ‘econ’ option. This decomposition yields three matrices: U (containing the left singular vectors), S (containing the singular values as a diagonal matrix), and V (containing the right singular vectors).
- Visualizing Singular Values: The code generates a plot of the singular values obtained from the SVD. The x-axis represents the index of the singular value, and the y-axis represents the magnitude of the singular value. This plot helps to visualize the significance of each singular value.
- Visualizing Principal Components (Eigenvectors): The code generates another set of plots to visualize the first few principal components (eigenvectors) obtained from the SVD. It reshapes each eigenvector back to the original image dimensions and displays them using imshow. These eigenvectors represent the dominant modes of variation in the dataset.
Question-2
In the Singular Value Decomposition (SVD) applied to image analysis:
U matrix: The left singular vectors are in this matrix. When it comes to pictures, these vectors are what make up the “face space.” Each cell in the U matrix is an eigenface or a main component
images aligned and cropped Cropped photos are those in which a certain part of the picture—in this example, the subject’s face—has been removed. This is commonly done to isolate the subject’s face from their surroundings. Facial characteristics, such as the eyes, nose, and mouth, are also standardized in aligned photographs. By standardizing the placement of face features, this alignment makes further analysis more reliable and mitigates the impact of posture changes.
Advantages of Cropped and Aligned Images:
Reduced Variability: Cropped and matched pictures remove information that isn’t related to facial features. This lets algorithms focus only on facial features. This cuts down on the differences caused by different lights, backgrounds, and head positions.
Normalized Scale: Alignment makes sure that the size of each person’s face traits is the same, which makes it easier to compare and analyze them.
Robust Analysis: When photos are cropped and lined up, feature extraction is more reliable. Features like the eyes, nose, and mouth are always in the same place. This makes it easy to find these features and compare them between pictures.
Pose Invariance: Alignment lowers the number of different poses, which makes it possible for algorithms to recognise faces from different directions of the head.
Uncropped photos: Uncropped photos show the whole scene that the camera saw, so the face is often part of a bigger picture. There is more variety in these pictures because the scenery, lighting, and head positions are all different.( Liu et al., 2018).
Advantages of Uncropped Images:
Uncropped images provide context, which may be advantageous for some applications. For example, identifying individuals in real-world scenarios where the context is significant.
Realistic Representation: Uncropped images depict how features are encountered in the actual world, with scale, pose, and lighting variations.
When comparing cropped and uncropped images, it is essential to keep in mind the objectives of the analysis. If the objective is to obtain accurate and consistent face recognition and analysis under diverse conditions, cropped and aligned images are typically preferable. However, uncropped images may be more appropriate if the objective is to comprehend the effect of real-world variations on
Question-3
The Key parts of dimensionality reduction and approximation in SVD image analysis are the singular value spectrum and the number of modes (rank ‘r’) that are needed for good image reconstructions:
Spectrum of Singular Values: A picture of the singular values from the matrix makes up the singular value spectrum. Most of the time, the single numbers are put in order from highest to lowest (Kiani et al., 2021). The range shows how quickly the importance of each single number starts to go down. A steep drop-off means that a few main modes (eigenfaces) catch most of the difference in the data, while a shallow drop-off means that more modes are needed to accurately describe the data.
Number of Modes (Rank ‘r’): The form of the singular value spectrum determines how many modes (eigenfaces) are needed for good picture reconstruction. Setting a threshold or choosing a cut-off point on the single value range is a popular way to do this. The rank ‘r’ of the estimate is determined by this cutoff. If the number ‘r’ is higher, more eigenfaces are used, which captures more variation but could also add noise. A smaller rank ‘r’ means that fewer eigenfaces are used, which makes the representation simpler but could mean that important features are lost. The best ‘r’ number strikes a balance between these trade-offs.
Question-4
In the face recognition and analysis, comparing cropped and uncropped photos can shed light on the following aspects of data quality and analysis: facial recognition or if contextual information is important.
Question-5
The effect of picture rotation on Singular Value Decomposition (SVD) analysis is being evaluated. The fundamental action of image rotation in image processing can alter the original organization and properties of a picture collection. The code snippet is concerned with learning whether or not the SVD of rotated photos yields useful insights into the dataset’s variability.
The initial steps involve defining a rotation matrix with an angle of interest (30 degrees here). Images may be transformed using this matrix while maintaining their original proportions and details. The rotation matrix is applied to the original pictures array, rotating each image by the specified amount. The photos that were rotated are saved in the rotated images array.
The algorithm then uses SVD analysis to examine the rotated pictures in the same way it did the originals. To use SVD, the rotational pictures are first transformed into a flattened matrix. Plots of the SVD’s singular values reveal patterns in their distribution. Knowing the number of important modes of variation is useful for compression and feature extraction, and this is commonly approximated with a low-rank approximation.
