yonghaoxu / ssun Goto Github PK
View Code? Open in Web Editor NEW[IEEE TGRS 2018] Spectral-Spatial Unified Networks for Hyperspectral Image Classification
License: MIT License
[IEEE TGRS 2018] Spectral-Spatial Unified Networks for Hyperspectral Image Classification
License: MIT License
Hi,
I would like to reproduce your experiment. Could you please give the versions of the dependency libraries?
Dear Yonghao, can you please explain the use of palette in the DrawResult function and the use of separate values for the three different hyperspectral image datasets.
how to modify the following code for Indian Pines? because Pavia University dataset has 9 class and Indian Pines 16.
w=2
num_PC=1
israndom=True
randtime = 1
OASpectral_IP = np.zeros((9+2,randtime))
s1s2=1
OASpectral_Pavia1 = 'spec1'
time_step = 3
for r in range(0,randtime):
#################Pavia#################
dataID=2
data = HyperspectralSamples(dataID=dataID, timestep=time_step, w=w, num_PC=num_PC, israndom=israndom, s1s2=s1s2)
X = data[0]
X_train = data[1]
X_test = data[2]
XP = data[3]
XP_train = data[4]
XP_test = data[5]
Y = data[6]-1
Y_train = data[7]-1
Y_test = data[8]-1
batch_size = 128
nb_classes = Y_train.max()+1
nb_epoch = 50
nb_features = X.shape[-1]
img_rows, img_cols = XP.shape[1],XP.shape[1]
# convert class vectors to binary class matrices
y_train = np_utils.to_categorical(Y_train, nb_classes)
y_test = np_utils.to_categorical(Y_test, nb_classes)
model = LSTM_RS(time_step=time_step,nb_features=nb_features)
tic1 = time.clock()
histloss=model.fit([X_train], [y_train], nb_epoch=nb_epoch, batch_size=batch_size, verbose=1, shuffle=True)
losses = histloss.history
toc1 = time.clock()
tic2 = time.clock()
PredictLabel = model.predict([X_test],verbose=1).argmax(axis=-1)
toc2 = time.clock()
OA,Kappa,ProducerA = CalAccuracy(PredictLabel,Y_test[:,0])
OASpectral_IP[0:9,r] = ProducerA
OASpectral_IP[-2,r] = OA
OASpectral_IP[-1,r] = Kappa
Thank you sharing the code.
Could you please give me an insight of "MirrowCut function" in HyperFunctions.py file?
Dear YonghaoXu, can you please clarify the use of s1s2 =1 and s1s2=2 in HyperspectralSamples function of HyperFunctions module.
Hi, I would like to get the parameters used for the KSC and Indian Pines datasets if possible.
I run the spectral group strategy(sls2=2)
batch_size=64 (in the paper)
np_epoch=500
PaviaU: Mean oa:91.43 Std oa:1.61 Mean kappa: 90.15 Std Kappa 1.09
Indian_Pines: Mean oa:80.76 Std oa:2.77 Mean kappa: 79.42 Std Kappa 2.55
KSC: Mean oa:89.69 Std oa:1.12 Mean kappa: 89.13 Std Kappa 1.02
Dear Yonghao, can you please tell me how did you choose the values of train_num_array for different datasets in HyperspectralSamples function. What is the significance of those values.
Dear Yonghao. I am getting the error "The pool_size
argument must be a tuple of 2 integers. Received: (1, 2, 2)" while using your function MCNN_RS.
Hello, I want to get the code of comparative Ablation Experiment in the paper, is that ok
Can you clarify the expression X_reshape[:,j,:] = X[:,j:j+(nb_features-1)*timestep+1:timestep]. When I am trying to run j:j+(nb_features-1)*timestep+1:timestep in a jupyter notebook ,it is showing syntax error. I want to test for every value of j in python. Can you please suggest a method for testing the loop.
Hello Dear ! I wan to know how you extract the feature from layers? suppose if we have shape (145,145,30) so how we can extract features from this type of data? if you have code about this kindly share. other thing is that please let us know how to plot that error curves? thanks for help
labels=sio.loadmat("Indian_pines_gt.mat")['indian_pines_gt']
palette=np.array([[255,0,0],[0,255,0],[0,0,255],[255,255,0],[0,255,255],[255,0,255],[176,48,96],[46,139,87],[160,32,240],[255,127,80],[127,255,212],[218,112,214],[160,82,45],[127,255,0],[216,191,216],[238,0,0]])
palette=palette*1.0/255
X_result=np.zeros((labels.shape[0],3))
num_class=labels.max()
or i in range(0,num_class):
X_result[np.where(labels==i),0]=palette[i,0]
X_result[np.where(labels==i),1]=palette[i,1]
X_result[np.where(labels==i),2]=palette[i,2]
X_result=np.reshape(X_result,(145,145,3))
I am getting the following error,
ValueError: cannot reshape array of size 435 into shape (145,145,3)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.