Giter Club home page Giter Club logo

a2s2k-resnet's Introduction

PWC

PWC

PWC

Attention-Based Adaptive Spectral-Spatial Kernel ResNet for Hyperspectral Image Classification

This repository is the official implementation of Attention-Based Adaptive Spectral-Spatial Kernel ResNet for Hyperspectral Image Classification. Open A2S2K-ResNet in Colab

📋 Abstract: Hyperspectral images (HSIs) provide rich spectral-spatial information with stacked hundreds of contiguous narrowbands. Due to the existence of noise and band correlation, the selection of informative spectral-spatial kernel features poses a challenge. This is often addressed by using convolutional neural networks (CNNs) with receptive field (RF) having fixed sizes. However, these solutions cannot enable neurons to effectively adjust RF sizes and cross-channel dependencies when forward and backward propagations are used to optimize the network. In this article, we present an attention-based adaptive spectral-spatial kernel improved residual network (A²S²K-ResNet) with spectral attention to capture discriminative spectral-spatial features for HSI classification in an end-to-end training fashion. In particular, the proposed network learns selective 3-D convolutional kernels to jointly extract spectral-spatial features using improved 3-D ResBlocks and adopts an efficient feature recalibration (EFR) mechanism to boost the classification performance. Extensive experiments are performed on three well-known hyperspectral data sets, i.e., IP, KSC, and UP, and the proposed A²S²K-ResNet can provide better classification results in terms of overall accuracy (OA), average accuracy (AA), and Kappa compared with the existing methods investigated.

Requirements

To install requirements:

conda env create -f environment.yml

To download the dataset and setup the folders, run:

bash setup_script.sh

Training

To train the model(s) in the paper, run this command in the A2S2KResNet folder:

python A2S2KResNet.py -d <IN|UP|KSC> -e 200 -i 3 -p 3 -vs 0.9 -o adam

Results

Our model achieves the following performance on 10% of datasets:

India Pines dataset

Model name OA
A2S2K-ResNet 98.66 ± 0.004 %
Model name OA
A2S2K-ResNet 99.34 ± 0.001 %
Model name OA
A2S2K-ResNet 99.85 ± 0.001 %

For deatiled results refer to Table IV-VII of our paper.

Citation

If you use A2S2K-ResNet code in your research, we would appreciate a citation to the original paper:

@article{roy2020attention,
	title={Attention-based adaptive spectral-spatial kernel resnet for hyperspectral image classification},
	author={Swalpa Kumar Roy, and Suvojit Manna, and Tiecheng Song, and Lorenzo Bruzzone},
	journal={IEEE Transactions on Geoscience and Remote Sensing},
	volume={59},
	no.={9},
	pp.={7831-7843},
	year={2021},
	publisher={IEEE}
	}	

a2s2k-resnet's People

Contributors

suvojit-0x55aa avatar swalpa 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

a2s2k-resnet's Issues

ouput was empty file

record.record_output( OA, AA, KAPPA, ELEMENT_ACC, TRAINING_TIME, TESTING_TIME, './report/' + 'SSRNpatch:' + str(img_rows) + '_' + Dataset + 'split' + str(VALIDATION_SPLIT) + 'lr' + str(lr) + PARAM_OPTIM + '.txt')
Utils.generate_png( all_iter, net, gt_hsi, Dataset, device, total_indices, './classification_maps/' + 'SSRNpatch:' + str(img_rows) + '_' + Dataset + 'split' + str(VALIDATION_SPLIT) + 'lr' + str(lr) + PARAM_OPTIM)
the report and classification folder need to be created additionally,Right?
And there is no output '.txt' and '.png'file generated as program descripition.

softmax of the attention vector

attention_vector = torch.cat( [ self.conv_ex(Z).unsqueeze(dim=1), self.conv_ex(Z).unsqueeze(dim=1) ], dim=1)
attention_vector = self.softmax(attention_vector)
and self.softmax = nn.Softmax(dim=1)
it seems that the elements of the attention_vector are the same, so if you apply softmax on dim=1,the result of the softmax will all be the same, 0.5 for sure

so why are we doing this,i don't know if i have missed something

image

Total sample pixels (TOTAL_SIZE)

Good afternoon,

I have question, how do you calculate what would be your TOTAL_SIZE value in data loader:

def load_dataset(Dataset, split=0.9):
data_path = '../dataset/'
if Dataset == 'IN':
mat_data = sio.loadmat(data_path + 'Indian_pines_corrected.mat')
mat_gt = sio.loadmat(data_path + 'Indian_pines_gt.mat')
data_hsi = mat_data['indian_pines_corrected']
gt_hsi = mat_gt['indian_pines_gt']
K = 200
TOTAL_SIZE = 10249 # THIS VALUE
VALIDATION_SPLIT = split
TRAIN_SIZE = math.ceil(TOTAL_SIZE * VALIDATION_SPLIT)

I read in your paper that you call it Total sample pixels, but not sure how this value can be calculated?

Thank you and appreciate your effort for this paper, very interesting approach.

Gratitude!

Thank you !The model you proposed was very useful to me !!

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.