(Part 1) Importance of Dimensionality Reduction in Computer Vision (2 Marks)
Digital images, especially high-resolution ones, contain a vast amount of data. When an image of size pixels is treated as a data point (e.g., by flattening it into a vector), its dimensionality is . This high dimensionality poses several challenges in computer vision tasks:
- The Curse of Dimensionality: As dimensionality increases, the volume of the data space grows exponentially. This makes the available data points sparse, requiring significantly more data to train models effectively and avoid overfitting. Many algorithms struggle to generalize well in very high-dimensional spaces.
- Computational Complexity: Processing, storing, and analyzing high-dimensional data is computationally expensive. Algorithms operating on raw pixel data (like classification, clustering, or retrieval) become slow and memory-intensive.
- Redundancy and Noise: Raw pixel data often contains significant redundancy (e.g., strong correlations between adjacent pixels) and noise. Dimensionality reduction techniques aim to capture the essential structure (variance) while discarding redundancy and some noise, leading to more robust representations.
Therefore, dimensionality reduction is crucial in computer vision to:
- Improve computational efficiency (faster training and inference, lower memory usage).
- Mitigate the curse of dimensionality, potentially leading to better model generalization.
- Extract meaningful features by removing redundancy and noise.
(Part 2) Block-Based PCA for Dimensionality Reduction on Grayscale Images (10 Marks)
Principal Component Analysis (PCA) is a standard technique for dimensionality reduction. It identifies the directions (principal components) along which the variance in the data is maximal. Applying PCA directly to an entire image (flattened into a vector) is often computationally infeasible due to the large size of the covariance matrix (). Block-based PCA offers a more practical approach by operating on smaller image patches (blocks).
Here’s how block-based PCA serves the purpose of dimensionality reduction for a digital grayscale image :
1. Image Representation and Block Extraction:
- Let the grayscale image be .
- Divide the image into small, possibly overlapping or non-overlapping blocks of size pixels (e.g., ).
- Each block is flattened (e.g., row by row) into a vector , where .
- Collect a large set of these block vectors from the image (or a representative set of training images) to form a dataset , where is the total number of blocks.
2. Apply PCA to the Set of Blocks:
- Mean Subtraction: Calculate the mean block vector . Subtract the mean from each block vector: . Let be the matrix of mean-centered block vectors.
- Covariance Matrix: Compute the sample covariance matrix of the block vectors: is a matrix ().
- Eigendecomposition: Find the eigenvalues and the corresponding orthonormal eigenvectors of the covariance matrix : The eigenvectors are the principal components of the block data. They represent the primary modes of variation within the image blocks and can be visualized as “eigenblocks”.
3. Dimensionality Reduction:
- Select Principal Components: Choose the top eigenvectors (where ) corresponding to the largest eigenvalues. These eigenvectors capture the most significant variance in the block data. Form a projection matrix . is a matrix.
- Projection (Encoding): For any given block from the image, first subtract the mean: . Then, project this mean-centered block onto the -dimensional subspace spanned by the selected eigenvectors: The vector is the low-dimensional representation of the original -dimensional block .
4. How Dimensionality Reduction is Achieved:
- Instead of storing or processing the original pixel values for each block, we now store or process only the coefficients in the vector .
- Since we choose (e.g., reducing a dimensional block to or dimensions), we achieve significant dimensionality reduction for each block.
- The entire image can then be represented by the collection of these low-dimensional vectors for all its blocks, along with the projection matrix and the mean block (which are computed once from the training set).
5. Reconstruction (Optional but Illustrative):
- An approximation of the original block can be reconstructed from its low-dimensional representation : (Project back to the original -dimensional space)
- The quality of the reconstruction depends on the number of principal components retained. Using more components leads to better reconstruction but less dimensionality reduction.