Hyperspectral Image Classification with CNN and AE by Lalan KumarHyperspectral Image Classification with CNN and AE by Lalan Kumar

Hyperspectral Image Classification with CNN and AE

Lalan Kumar

Lalan Kumar

Hyperspectral Image Classification (HIC)

🌐 Project Overview

Hyperspectral Image Classification (HIC) is an advanced machine learning project designed to extract meaningful insights from hyperspectral imagery using state-of-the-art deep learning techniques. This workflow combines Convolutional Neural Networks (CNN) and Autoencoder (AE) models to provide robust and accurate classification of hyperspectral data.

šŸ”¬ Scientific Background

Hyperspectral imaging captures electromagnetic radiation across numerous contiguous spectral bands, providing rich spectral information beyond traditional RGB imaging. This project addresses critical challenges in:
Land use classification
Agricultural monitoring
Environmental research
Remote sensing applications

Example Images

šŸ—ļø Project Architecture

Key Components

Data Processing
Data Ingestion: Sophisticated loading and preprocessing of complex hyperspectral datasets
Data Transformation: Advanced feature extraction and normalization techniques
Machine Learning Models
Convolutional Neural Network (CNN):
Specialized architecture for spatial-spectral feature learning
High-performance classification across multiple spectral domains
Autoencoder (AE):
Dimensionality reduction
Feature representation learning
Noise reduction and data compression
Computational Pipelines
Training Pipeline: End-to-end model training workflow
Prediction Pipeline: Seamless inference and classification

šŸ“‚ Project Structure

HIC/
│
ā”œā”€ā”€ DATA/ # Raw hyperspectral image datasets
│ ā”œā”€ā”€ Botswana/ # Regional hyperspectral dataset
│ │ ā”œā”€ā”€ Botswana.mat # Hyperspectral image data
│ │ └── Botswana_gt.mat # Ground truth labels
│ └── KSC/ # Kennedy Space Center dataset
│ ā”œā”€ā”€ KSC.mat # Hyperspectral image data
│ └── KSC_gt.mat # Ground truth labels
│
ā”œā”€ā”€ artifacts/ # Project output
│ ā”œā”€ā”€ trained_models/
│ ā”œā”€ā”€ visualizations/
│ └── results/
│
ā”œā”€ā”€ config/ # Configuration management
│ └── config.yaml # Project configuration file
│
ā”œā”€ā”€ logs/ # Execution and debugging logs
│
└── src/ # Source code
ā”œā”€ā”€ __init__.py
ā”œā”€ā”€ exception.py # Custom exception handling
ā”œā”€ā”€ logger.py # Logging configuration
ā”œā”€ā”€ utils.py # Utility functions
│
ā”œā”€ā”€ components/ # Data processing modules
│ ā”œā”€ā”€ __init__.py
│ ā”œā”€ā”€ data_ingestion.py # Data loading and preprocessing
│ ā”œā”€ā”€ data_transformation.py # Feature extraction and normalization
│ └── model_trainer.py # Model training utilities
│
ā”œā”€ā”€ models/ # Neural network architectures
│ ā”œā”€ā”€ __init__.py
│ ā”œā”€ā”€ ae_model.py # Autoencoder model definition
│ └── cnn_model.py # CNN model definition
│
└── pipeline/ # Machine learning workflows
ā”œā”€ā”€ __init__.py
ā”œā”€ā”€ predict_pipeline.py # Inference and prediction workflow
└── train_pipeline.py # Model training workflow

šŸš€ Getting Started

Prerequisites

Python 3.8+
Machine learning libraries (NumPy, Pandas, Scikit-learn)
Deep learning framework (TensorFlow/PyTorch)
CUDA-compatible GPU (recommended)

Installation

# Clone the repository
git clone https://github.com/your-username/HyperSpectral-AI.git

# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`

# Install dependencies
pip install -r requirements.txt

Quick Start

# Train the model
python -m src.pipeline.train_pipeline

# Run predictions
python -m src.pipeline.predict_pipeline

šŸ“Š Supported Datasets

Botswana Hyperspectral Dataset
Geographic region: Southern Africa
Spectral characteristics: High-resolution land cover classification
Kennedy Space Center (KSC) Hyperspectral Dataset
Geographic region: Florida, United States
Applications: Coastal and environmental monitoring
Pavia University (PaviaU) Dataset
Geographic region: Northern Italy
Applications: Urban area classification
Pavia Centre (PaviaC) Dataset
Geographic region: Pavia city center, Italy
Applications: Urban material and structure identification
Indian Pines Dataset
Geographic region: Northwestern Indiana, United States
Applications: Agricultural area classification
šŸ’” Pro Tip: Add your custom hyperspectral datasets to the DATA/ directory

šŸ› ļø Development Principles

Object-oriented design
Modular architecture
PEP 8 and PEP 257 compliance
Comprehensive error handling
Detailed logging

šŸ¤ Contributing

Fork the repository
Create your feature branch (git checkout -b feature/AmazingFeature)
Commit your changes (git commit -m 'Add some AmazingFeature')
Push to the branch (git push origin feature/AmazingFeature)
Open a Pull Request

šŸ“œ License

MIT License
Like this project

Posted Jul 30, 2025

Advanced ML project for hyperspectral image classification using CNN and AE models.