Code Monkey home page Code Monkey logo

ssun's People

Contributors

yonghaoxu 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

Watchers

 avatar  avatar

ssun's Issues

use of palette

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.

Need help

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

About group strategy test accuracy in the paper

I run the spectral group strategy(sls2=2)
batch_size=64 (in the paper)
np_epoch=500

each datasets run all 30 times
But I get the following result:

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

X[:,j:j+(nb_features-1)*timestep+1:timestep]

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.

Need help with Feature Extracted

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

ValueError: cannot reshape array of size 435 into shape (145,145,3)

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)

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.