konstantinosf / classification-of-hyperspectral-image Goto Github PK
View Code? Open in Web Editor NEWClassification of the Hyperspectral Image Indian Pines with Convolutional Neural Network
License: MIT License
Classification of the Hyperspectral Image Indian Pines with Convolutional Neural Network
License: MIT License
In the training of the CNN, the input is of size (5,5,30)
instead of (30,5,5)
and as a result the model handles the input as an image of size 30x5 with 5 channels instead of a 5x5 image with 30 channels.
In TrainTheModel file
Line number [5]
X_train = np.reshape(X_train, (X_train.shape[0],X_train.shape[3], X_train.shape[1], X_train.shape[2]))
IndexError Traceback (most recent call last)
in ()
1 # Reshape into (numberofsumples, channels, height, width)
----> 2 X_train = np.reshape(X_train, (X_train.shape[0],X_train.shape[3], X_train.shape[1], X_train.shape[2]))
IndexError: tuple index out of range
Hi, thanks a lot for such a helpful repository. I see the code does not classify the marginal pixels when building the classification maps. Would you fix it later?
How can I solve it? Thank you very much.
FileNotFoundError: [Errno 2] No such file or directory: '/home/deeplearning/Desktop/GITHUB/XtrainWindowSize5PCA30testRatio0.25.npy'
Index error is thrown,
convert the calculated index to type int(), the expression actually returns float object.
Please change it to -
target = int(y[int(i+PATCH_SIZE/2), int(j+PATCH_SIZE/2]))`
outputs[int(i+PATCH_SIZE/2)][int(j+PATCH_SIZE/2/)] = prediction+1
Firstly, thanks for this amazing code. It is very nice and I learned a lot from this. However, I saw your datasets are corrected. Can you please tell me how did you do the corrections and please give me the link of the code you are using? TIA
hello,
I tried the code, the frist two-CreatetheDatasets and TrainTheModel all run successfully, but when I run the last code-validation, the sentence "file_name = 'report'+"WindowSize" + str(windowSize) + "PCA" + str(numComponents) + "testRatio" + str(testRatio) +".txt"" represent the question, said "NameError: name 'numComponents' is not defined",
This mean it can't find the corresponding file and data, which means I didn't save some training results?
I don't know how to slove, can you help me?
thanks a lot
Thanks for the work, I have tried the code, but it can not reach a high accuracy result as posted in the original paper.
The following are my results:
Train on 29685 samples, validate on 2563 samples
Epoch 1/15
29685/29685 [==============================] - 8s 258us/step - loss: 2.5315 - acc: 0.2048 - val_loss: 2.4267 - val_acc: 0.3531
Epoch 2/15
29685/29685 [==============================] - 7s 239us/step - loss: 1.9284 - acc: 0.4615 - val_loss: 1.8825 - val_acc: 0.5099
Epoch 3/15
29685/29685 [==============================] - 7s 240us/step - loss: 1.4118 - acc: 0.5917 - val_loss: 1.3746 - val_acc: 0.6278
Epoch 4/15
29685/29685 [==============================] - 7s 239us/step - loss: 1.0785 - acc: 0.6655 - val_loss: 1.1172 - val_acc: 0.6859
Epoch 5/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.8887 - acc: 0.7122 - val_loss: 0.9545 - val_acc: 0.7323
Epoch 6/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.7718 - acc: 0.7483 - val_loss: 0.8611 - val_acc: 0.7554
Epoch 7/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.6798 - acc: 0.7747 - val_loss: 0.7822 - val_acc: 0.7706
Epoch 8/15
29685/29685 [==============================] - 7s 241us/step - loss: 0.6123 - acc: 0.7953 - val_loss: 0.7271 - val_acc: 0.7799
Epoch 9/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.5648 - acc: 0.8120 - val_loss: 0.6752 - val_acc: 0.7936
Epoch 10/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.5189 - acc: 0.8262 - val_loss: 0.6337 - val_acc: 0.8053
Epoch 11/15
29685/29685 [==============================] - 7s 241us/step - loss: 0.4804 - acc: 0.8420 - val_loss: 0.5988 - val_acc: 0.8092
Epoch 12/15
29685/29685 [==============================] - 7s 240us/step - loss: 0.4488 - acc: 0.8496 - val_loss: 0.5717 - val_acc: 0.8174
Epoch 13/15
29685/29685 [==============================] - 7s 242us/step - loss: 0.4181 - acc: 0.8618 - val_loss: 0.5408 - val_acc: 0.8205
Epoch 14/15
29685/29685 [==============================] - 7s 243us/step - loss: 0.3959 - acc: 0.8701 - val_loss: 0.5088 - val_acc: 0.8283
Epoch 15/15
29685/29685 [==============================] - 7s 241us/step - loss: 0.3730 - acc: 0.8765 - val_loss: 0.5010 - val_acc: 0.8221
Can you tell me what is the reason? Thanks in advance.
Hello, @KonstantinosF, thank you for sharing. I was trying the code and was getting an error when doing the final prediction. It seems image_patch=Patch(X,i,j) gives out a none type object.
X_test_image = image_patch.reshape(1,image_patch.shape[2],image_patch.shape[0],image_patch.shape[1]).astype('float32')
AttributeError: 'NoneType' object has no attribute 'reshape'
function: CreatetheDataSets.AugmentData
patch2 = flipped_patch
X_train[i,:,:,:] = patch2
These two lines of code are unnecessary as flipped_patch and X_train all point to the same object.
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.