syamkakarla98
Dimensionality-reduction-and-classification-on-Hyperspectral-Images-Using-Python
Jupyter Notebook

In this repository, You can find the files which implement dimensionality reduction on the hyperspectral image(Indian Pines) with classification.

Last updated Sep 14, 2025
84
Stars
34
Forks
0
Issues
0
Stars/day
Attention Score
41
Language breakdown
No language data available.
Files click to expand
README

Dimensionality reduction and classification on Hyperspectral Image Using Python

Authors

* DR.T.Hitendra Sarma * Syam Kakarla

Prerequisites

The prerequisites to better understand the code and concept are:

* Python     * MatLab     * Linear Algebra

Installation

  • This project is fully based on python. So, the necessary modules needed for computaion are:
* Numpy
    * Sklearn
    * Matplotlib
    * Pandas
  • The commands needed for installing the above modules on windows platfom are:
pip install numpy
    pip install sklearn
    pip install matplotlib
    pip install pandas
  • we can verify the installation of modules by importing the modules. For example:
import numpy
    from sklearn.decomposition import PCA 
    import matplotlib.pyplot as plt
    import pandas as pd

Results

* Here we are performing the the dimensionality reduction on one of the widely used hyperspectral image Indian Pines

  • The result of the indianpinespca.py is shown below:

    * It initial result is a bargraph for the first 10 Pricipal Components according to their variance ratio's :

    indian<em>pines</em>varianve_ratio Since, the initial two principal COmponents have high variance. so, we will select the initial two PC'S. * It second result is a scatter plot for the first 10 Pricipal Components is :

    indian<em>pines</em>after<em>pca</em>with_2pc

    * The above program resullts a dimensionally reduced csvfile .

    * The above program will classify the Indian Pines dataset before Principal Component Analysis(PCA). The classifier here used for classification is K-Nearest Neighbour Classifier (KNNC) * The time taken for classification is: indian<em>pines</em>classification<em>before</em>pca

    * Then the classification accuracy of indian pines dataset before PCA is: indian<em>pines</em>accuracy<em>before</em>pca

    • The result of the indianpinesknncafter_pca.py

      * Then the resultant classification accuracy of indian pines dataset after PCA is: indian<em>pines</em>accuracy<em>after</em>pca

      Conclusion :

      * By performing PCA on the corrected indian pines dataset results 100 Principal Components(PC'S). * since, the initial two Principal Components(PC'S) has 92.01839071674918 variance ratio. we selected two only. * Initially the dataset contains the dimensions 21025 X 200 is drastically reduced to 21025 X 2 dimensions. * The time taken for classification before and after Principal Component Analysis(PCA) is: | Dataset | Accuracy | Time Taken | | ------------- |:-----------: | ----------:| | Before PCA | 72.748890 | 17.6010 | | After PCA | 60.098187 | 0.17700982 | * Hence, the time has been reduced with a lot of difference and the classification accuracy(C.A) also reduced but the C.A can increased little bit by varying the 'k' value.

      License

      This project is licensed under the MIT License - see the LICENSE.md file for details

🔗 More in this category

© 2026 GitRepoTrend · syamkakarla98/Dimensionality-reduction-and-classification-on-Hyperspectral-Images-Using-Python · Updated daily from GitHub