This repository guarantees you to reproduce the results reported in the following two papers:
- Spectral-spatial classification of hyperspectral image using autoencoders
- Deep Learning-Based Classification of Hyperspectral Data
If you think it helpful, we would appreciate if you cite these papers in your work.
- Theano
If you were using Ubuntu, simply type
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
in your terminal. If you were not in Ubuntu, you can find all the information you need at here.
- scikit-learn
Scikit-learn is used to run control group experiments, you can skip it if you don't care about reproducing those SVM results or confusion matrices. To install it, simply type the following command:
pip install -U scikit-learn
- PIL
PIL is used to visualize weights and classification results on the whole image. It could also be skipped. To install it, type:
sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
pip install PIL
- CUDA
If you have a CUDA enabled GPU with you, that would save you a lot of time. But it is still OK to run all the experiments without GPU, at the expense of more patience.
Download the two datasets used in the paper by typing the corresponding commands into your terminal:
-
wget http://www.ehu.eus/ccwintco/uploads/e/ee/PaviaU.mat wget http://www.ehu.eus/ccwintco/uploads/5/50/PaviaU_gt.mat
-
wget http://www.ehu.es/ccwintco/uploads/2/26/KSC.mat wget http://www.ehu.es/ccwintco/uploads/a/a6/KSC_gt.mat
Change the loading directory in each .py file to wherever you store your datasets.
-
To train a stacked autoencoder on spectral information, execute
python pavia_SdA.py
for Pavia dataset, or
python ksc_SdA.py
for KSC dataset.
These experiments correspond to the classical way of classifying spectra, without considering the spatial correlations in HSI.
-
To train the model on spatial information, execute
python pavia_spatial_SdA.py
for Pavia dataset, or
python ksc_spatial_SdA.py
for KSC dataset.
These experiments extract features in a novel way. Those features emphasize on spatial correlations in an HSI dataset. It shows that even discarding the majority of spectral dimensions, classification could still be performed successfully.
-
To train the model on joint spectral-spatial information, execute
python pavia_joint_SdA.py
for Pavia dataset, or
python ksc_joint_SdA.py
for KSC dataset.
These experiments utilizes both spectral and spatial information. They reach the state-of-the-art on both datasets, surpassing a SVM with heavily tuned parameters.
Zhouhan Lin: zhouhan.lin [at] umontreal.ca