Giter Club home page Giter Club logo

ssrn's Introduction

Implementation of SSRN for Hyperspectral Image Classification

Paper links: IEEE T-GARS paper and IGARSS2017 paper. Code download link: SSRN code.

UPDATE: A PyTorch implementation of SSRN is available at SSTN, which contains SSRNs for the KSC, PC, IN, and UP datasets. Specifically, you can find it here: PyTorch-SSRN

Here are the bibliography info:

@article{zhong2018spectral,
  title={Spectral-Spatial Residual Network for Hyperspectral Image Classification: A 3-D Deep Learning Framework},
  author={Zhong, Zilong and Li, Jonathan and Luo, Zhiming and Chapman, Michael},
  journal={IEEE Transactions on Geoscience and Remote Sensing},
  volume={56},
  number={2},
  pages={847--858},
  year={2018},
  publisher={IEEE}
}

Descriptions

In this paper, we designed an end-to-end spectral-spatial residual network (SSRN) that takes raw 3D cubes as input data without feature engineering for hyperspectral image classification. In this network, the spectral and spatial residual blocks consecutively learn discriminative features from abundant spectral signatures and spatial contexts in hyperspectral imagery (HSI).

Fig.1 Spectral Residual Block

Fig.2 Spatial Residual Block

Fig.3 Spectral-Spatial Residual Network with a 7x7x200 input HSI volume. The network includes two spectral and two spatial residual blocks. An average pooling layer and a fully connected layer transform a 5x5x24 spectral-spatial feature volume into a 1x1xL output feature vector

The proposed SSRN is a supervised deep learning framework that alleviates the declining-accuracy phenomenon of other deep learning models. Specifically, the residual blocks connect every other 3D convolutional layer through identity mapping, which facilitates the back propagation of gradients. Furthermore, we impose batch normalization on every convolutional layer to regularize the learning process and improve the classification performance of trained models. Quantitative and qualitative results demonstrate that SSRN achieved the state-of-the-art HSI classification accuracy in different kinds of hyperspectral datasets.

Prerequisites

When you create a conda environment, check you have installed the packages in the package-list. You can also refer to the managing environments of conda.

Usage

Train models with commonly studied hyperspectral imagery (HSI) datasets:

$ python ./SSRN_IN.py
$ python ./SSRN_UP.py

Evaluate saved trained models:

$python ./Load_Models/Load_IN.py
$python ./Load_Models/Load_UP.py

Illustrate final classification maps:

$python ./Classification\ Maps/IN_classification_maps.py
$python ./Classification\ Maps/UP_classification_maps.py

If you encountered problems like " no such file or direcotry", please check the corresponding paths and change them to absolute paths.

Results

Indian Pines (IN) dataset

Fig.4 The IN dataset classification result (Overall Accuracy 99.44%) of SSRN using 20% samples for training. (a) False color image. (b) Ground truth labels. (c) Classification map.

University of Pavia (UP) dataset

Fig.5 The UP dataset classification result (Overall Accuracy 99.91%) of SSRN using 10% samples for training. (a) False color image. (b) Ground truth labels. (c) Classification map.

IGARSS Presentation

IMAGE ALT TEXT HERE

Acknowledgement

Part of codes is from a wonderful implementation of ResNet by Raghavendra Kotikalapudi.

ssrn's People

Contributors

zilongzhong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssrn's Issues

Missing values during testing.

I am trying to reproduce the results but after training, I get a confusion matrix in which some classes have zero predictions. Can you tell me why it is? The problem is similar to #11

About False color image in Visualization_mat2rgb.py

data = data / 8000.
blue = data[:, :, 10] # 10 # blue band
green = data[:, :, 24] # 24 # green band
red = data[:, :, 44] # 44 # red band

Hello, I don't understand this code very well, Can you tell me something more? Is this code the same for different data sets? Or they (blue, green, red) correspond different band in a different dataset? Thanks.

Your code is not complete

hello, I`m a newcomer in HSI classification ,after try run your code ,I find your code miss a resnet.py document,can you release a complete code again?thank you very much

ValueError

Thank you for sharing the code.
I have tested the code with IndianPines dataset. When I run the IN_classification_maps,I met ValueError: could not convert string to float: 'normal'.How to solve this problem?

UnicodeDecodeError

Utils/modelStatsRecord.py", line 14
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xa1 in position 19: invalid start byte
I wonder the author could give me a complete code by email, beacuse the code I download have some UnicodeDecodeError.

Import error at Utils

in Running SSRN_IN.py the following error encountered
from Utils import zeroPadding, normalization, doPCA, modelStatsRecord, averageAccuracy, ssrn_SS_IN
since Utils is folder i am getting import error

About Utils file

Hello! Thank you for sharing the code! when I execute SSRN_UP.py file and SSRN_IN.py file ,the code from Utils import from Utils import zeroPadding, normalization, doPCA, modelStatsRecord, averageAccuracy, ssrn_SS_UP does not work. and Error message is: " import averageAccuracy ModuleNotFoundError: No module named 'averageAccuracy " . However, the averageAccuracy.py is available in the Utils file, how can i to revised it? Thanks!

About Utils file

Hi. when I execute SSRN_IN.py file, the code from Utils import zeroPadding, normalization, doPCA, modelStatsRecord, averageAccuracy, ssrn_SS_IN can works, but when I execute the IN_classification.py, the code above line not works, how can i to revised it? Thanks.

I am getting only class 16 indices.

Hello zhilongzhong .Could you go through the code in line number 40,41,42 in SSRN_IN.py file.The below line is giving me only indices of class 16.
m = np.max(groundTruth)
for i in range(m):
indices = [j for j, x in enumerate(groundTruth.ravel().tolist()) if x == i + 1]

IOError: Unable to create file

hello,when i run this code,the following error encountered. I don`t konw why.
2048/2055 [============================>.] - ETA: 0s - loss: 4.8819 - acc: 0.2090Epoch 00000: val_loss improved from inf to 4.92003, saving model to ./models/Indian_best_RES_3D_SS4_10_1.hdf5
Traceback (most recent call last):
File "SSRN_IN.py", line 191, in
nb_epoch=nb_epoch, shuffle=True, callbacks=[earlyStopping6, saveBestModel6])
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/training.py", line 1485, in fit
initial_epoch=initial_epoch)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/training.py", line 1160, in _fit_loop
callbacks.on_epoch_end(epoch, epoch_logs)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/callbacks.py", line 75, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/callbacks.py", line 400, in on_epoch_end
self.model.save(filepath, overwrite=True)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/topology.py", line 2416, in save
save_model(self, filepath, overwrite)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/keras/models.py", line 96, in save_model
f = h5py.File(filepath, 'w')
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/h5py/_hl/files.py", line 271, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/zhangxh/anaconda3/envs/py2/lib/python2.7/site-packages/h5py/_hl/files.py", line 107, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 98, in h5py.h5f.create
IOError: Unable to create file (File locking disabled on this file system (use hdf5_use_file_locking environment variable to override), errno = 38, error message = 'function not implemented')

Use of index to assignment

Can you please tell the use of the following code:-
assign_0 = value // Col + pad_length
assign_1 = value % Col + pad_length
new_assign[counter] = [assign_0, assign_1]

Where is the Indian_best_3DCONV.hdf5

Hi,where is the file Indian_best_3DCONV.hdf5
the code you have writen in the Real3D_Conv.py
best_weights_path = '/home/finoa/DL-on-HSI-Classification/Best_models/Indian_best_3DCONV.hdf5'

examples

can you add some examples so that i can use functions and classes esly ?

Some detail about SS-GAN

I've been trying to write the code about SS-GAN under the guide of your paper "Generative Adversarial Networks and Conditional Random Fields for Hyperspectral Image Classification" recently. And I am little bit confused with the architecture of the Generator. Did you used the Conv3Dtransposed(Keras) in your code? And could you please provide more details such as the
"subsample"? Thanks

file format.

I have .hdr hyperspectral file of Aviris-ng . how do i process that ?

Not getting the exact results

Thank you for sharing the code.
I have tested the code with IndianPines dataset. I have trained the model with 200 runs as it is mentioned on readme file. After 200 runs of training, each element in EachClassAccuracy are obtained as follows, but some of them are showing zeros values.
[1. 0.99557913 0.99250375 1. 0.99741602 1. 1. 1. 0. 0.99734748 0.97369727 1.

  1.     0.99457995    0.         0.        ] i.e. class- 9, 15,16 are not detected at all. 
    

The input patch length is 3.

Does code work on CPU please tell me

your cpu supports instructions that this tensorflow binary was not compiled to use: avx2 fma

taking longer time to train

Does it work on CPU please tell me

Remove specific labels from the ground truth

Hi, does anyone has a written code on how to remove certain labels from gt file?
I have seen this: set_zeros(gt_IN, [1,4,7,9,13,15,16]) in SSRN but the function is not defined. Thanks

Code issues

Please ask the code of the Classification Maps folder, can I generate only GT result classification charts in the result classification chart? I see that you only have the code to generate the full picture result classification chart in your code (that is, the classification result chart that does not include the background of 0 values), if there is, please send me an email: [email protected], thank you very much!

How to allocate data sets?

Thank you for your work. How do you split the training data set, validation data set and test data set? First, if the number of categories in a certain category is small, is there a chance that you will not be able to select it, and you will not be able to learn its features by SSRN? second,does the random selection destroy the distribution of the data?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.