Comments (10)
As mentioned in the paper, we use the same hyper-parameter setting for all three datasets. For experiments on the Indian Pines and KSC datasets, just replace dataID=1
in SSUN.py
to dataID=2
(for Indian Pines) and dataID=6
(for KSC), respectively.
from ssun.
As mentioned in the paper, we use the same hyper-parameter setting for all three datasets. For experiments on the Indian Pines and KSC datasets, just replace
dataID=1
inSSUN.py
todataID=2
(for Indian Pines) anddataID=6
(for KSC), respectively.
Alright, thanks.
from ssun.
But when I change the data id only I am getting the following error:
OASpectral_IP[0:9,r] = ProducerA
ValueError: could not broadcast input array from shape (16) into shape (9)
from ssun.
This error could be solved by changing the initialization of OASpectral_IP by OASpectral_IP = np.zeros((16+2,randtime))
, where 16
corresponds to the number of categories in the Indian Pines dataset.
from ssun.
I change it to:
OASpectral_IP = np.zeros((16+2,randtime))
s1s2=1
OASpectral_Pavia1 = 'spec1'
time_step = 3
But I am still getting this error:
File "SSUN.py", line 240, in
OASpectral_IP[0:9,r] = ProducerA
ValueError: could not broadcast input array from shape (16) into shape (9)
from ssun.
The ProducerA
vector contains the producer accuracy of the input data. Since there are 16
categories in the Indian Pines dataset, the ProducerA
vector should also have 16
elements. Thus, you can simply replace the 9
in the bracket by 16
. Similar modification could be made for the KSC dataset.
from ssun.
That is all the modification:
OASpectral_IP = np.zeros((16+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:16,r] = ProducerA
OASpectral_IP[-2,r] = OA
OASpectral_IP[-1,r] = Kappa
But still getting error:
Traceback (most recent call last):
File "SSUN.py", line 254, in
X_result = DrawResult(Spectral,1)
File "/home/alou/Desktop/ssun/train.py", line 117, in DrawResult
X_result[np.where(labels==i),0] = palette[i,0]
IndexError: index 9 is out of bounds for axis 0 with size 9
from ssun.
the train.py here represent your helper function.
from ssun.
You need to change the imageID
in DrawResult
func to generate the corresponding classification map. Please refer to the DrawResult
func in HyperFunctions.py
for details.
from ssun.
from ssun.
Related Issues (12)
- About group strategy test accuracy in the paper HOT 10
- Hello, I want to get the code of comparative Ablation Experiment in the paper, is that ok
- Need help
- Which versions of keras and theano were used in this implementation? HOT 2
- Data preparation understanding HOT 2
- ValueError: cannot reshape array of size 435 into shape (145,145,3) HOT 3
- use of palette HOT 2
- use of s1s2 in HyperspectralSamples function of HyperFunctions module HOT 1
- X[:,j:j+(nb_features-1)*timestep+1:timestep]
- How did you choose the values of train_num_array for different datasets in HyperspectralSamples function HOT 2
- The `pool_size` argument must be a tuple of 2 integers. Received: (1, 2, 2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ssun.