- 2019-06-21 16:16
*views 9*- BP neural network
- The error is large
- Hyperspectral image classification
- BP

I'm doing a talk about using BP Classification algorithm of hyperspectral image based on Neural Network , One pixel has 220 Spectral data , Each pixel corresponds to a class , It's known that there are 17 class , Now I'll find every type of data , The training set and test set are selected . The output of the training set is the category number , as 1,2,3,4 etc . After training the network, I will classify 1 The test set is brought into the network , The calculated output is equal to 1 It's quite different . The figure and source code are attached below , Please take a look at the gods , I have just come into contact with this knowledge .

clc; clear all; close all; %1. Import data

load('C:\Users\ Nerin \Desktop\Indian_pines.mat')

load('C:\Users\ Nerin \Desktop\Indian_pines_gt.mat') % take 145*145*220 Of 3 Dimension data becomes 2 Dimensional matrix x =

reshape(indian_pines,145*145,220); y = reshape(indian_pines_gt,145*145,1);

% Find all the categories , Training set and test set are divided %A1 Represents a category of 1 The row of ,B1 Represents the 1 The band corresponding to the class A1 = find(y == 1); B1 =

x(A1,:); %A2 Represents a category of 2 The row of ,B2 Represents the 2 The band corresponding to the class A2 = find(y==2); B2 = x(A2,:);

%A3 Represents a category of 3 The row of ,B3 Represents the 3 The band corresponding to the class A3 = find(y == 3); B3 = x(A3,:);

%A4 Represents a category of 4 The row of ,B4 Represents the 4 The band corresponding to the class A4 = find(y == 4); B4 = x(A4,:);

%A5 Represents a category of 5 The row of ,B5 Represents the 5 The band corresponding to the class A5 = find(y == 5); B5 = x(A5,:);

%A6 Represents a category of 6 The row of ,B6 Represents the 6 The band corresponding to the class A6 = find(y == 6); B6 = x(A6,:);

%A7 Represents a category of 7 The row of ,B7 Represents the 7 The band corresponding to the class A7 = find(y == 7); B7 = x(A7,:);

%A8 Represents a category of 8 The row of ,B8 Represents the 8 The band corresponding to the class A8 = find(y == 8); B8 = x(A8,:);

%A9 Represents a category of 9 The row of ,B9 Represents the 9 The band corresponding to the class A9 = find(y == 9); B9 = x(A9,:);

%A10 Represents a category of 10 The row of ,B10 Represents the 10 The band corresponding to the class A10 = find(y == 10); B10 = x(A10,:);

%A11 Represents a category of 11 The row of ,B11 Represents the 11 The band corresponding to the class A11 = find(y == 11); B11 = x(A11,:);

%A12 Represents a category of 12 The row of ,B12 Represents the 12 The band corresponding to the class A12 = find(y == 12); B12 = x(A12,:);

%A13 Represents a category of 13 The row of ,B13 Represents the 13 The band corresponding to the class A13 = find(y == 13); B13 = x(A13,:);

%A14 Represents a category of 14 The row of ,B14 Represents the 14 The band corresponding to the class A14 = find(y == 14); B14 = x(A14,:);

%A15 Represents a category of 15 The row of ,B15 Represents the 15 The band corresponding to the class A15 = find(y == 15); B15 = x(A15,:);

%A16 Represents a category of 16 The row of ,B16 Represents the 16 The band corresponding to the class A16 = find(y == 16); B16 = x(A16,:);

%A0 Represents a category of 0 The row of ,B0 Represents the 0 The band corresponding to the class A0= find(y == 0); B0= x(A0,:);

% Before taking each sample 70% As a training set , after 30% As test set . %C1 Represents the selection of the first category before 32 As a training set ,C2 Represents the selection of 2 Before class 1000 As a training set

%C3 Represents the selection of 3 Before class 581 As a training set ,C4 Represents the selection of 4 Before class 166 As a training set

%C5 Represents the selection of 5 Before class 338 As a training set ,C6 Represents the selection of 6 Before class 511 As a training set

%C7 Represents the selection of 7 Before class 20 As a training set ,C8 Represents the selection of 8 Before class 334 As a training set

%C9 Represents the selection of 9 Before class 14 As a training set ,C10 Represents the selection of 10 Before class 680 As a training set

%C11 Represents the selection of 11 Before class 1718 As a training set ,C12 Represents the selection of 12 Before class 415 As a training set

%C13 Represents the selection of 13 Before class 143 As a training set ,C14 Represents the selection of 14 Before class 885 As a training set

%C15 Represents the selection of 15 Before class 270 As a training set ,C16 Represents the selection of 16 Before class 65 As a training set %C0 Represents the selection of 0 Before class 7543 As a training set C1 =

B1(1:32,:); C2 = B2(1:1000,:); C3 = B3(1:581,:); C4 = B4(1:166,:); C5 =

B5(1:338,:); C6 = B6(1:511,:); C7 = B7(1:20,:); C8 = B8(1:334,:); C9 =

B9(1:14,:); C10 = B10(1:680,:); C11 = B11(1:1718,:); C12 = B12(1:415,:); C13 =

B13(1:143,:); C14 = B14(1:885,:); C15 = B15(1:270,:); C16 = B16(1:65,:); C0 =

B0(1:7543,:);

%D Represented by C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,C0 Training set ; D =

[C0;C1;C2;C3;C4;C5;C6;C7;C8;C9;C10;C11;C12;C13;C14;C15;C16]; % Set up test set M=

zeros(1,14715); M(1,1:7543) = 0; M(1,7544:7575) = 1; M(1,7576:8575) = 2;

M(1,8576:9156) = 3; M(1,9157:9322) = 4; M(1,9323:9660) = 5; M(1,9661:10171) =

6; M(1,10172:10191) = 7; M(1,10192:10525) = 8; M(1,10526:10539) = 9;

M(1,10540:11219) = 10; M(1,11220:12937) = 11; M(1,12938:13352) = 12;

M(1,13353:13495) = 13; M(1,13496:14380) = 14; M(1,14381:14650) = 15;

M(1,14651:14715) = 16; %2. Select training set and test set % Training set P_train_1 = D'; I_train_1 = M; % Test set

P_test_1 = (B1(33:46,:))' P_test_2 = (B2(1001:1400,:))' % data normalization

[P_train_1,ps_input]=mapminmax(P_train_1,0,1);

[I_train_1,ps_ouput]=mapminmax(I_train_1,0,1);

[P_test_1,ps_input]=mapminmax(P_test_1,0,1);

[P_test_2,ps_input]=mapminmax(P_test_2,0,1); % Creating networks

net=newff(P_train_1,I_train_1,15,{'tansig','purelin'},'traingd');

net.trainParam.epochs=20000; net.trainParam.goal=0.0001; net.trainParam.lr =

0.01; net = train(net,P_train_1,I_train_1); % Test the first type of training set t_sim1 =

sim(net,P_test_1); % Data inverse normalization I_sim1 = mapminmax('reverse',t_sim1,ps_ouput);

% Test section 2 Class training set t_sim2 = sim(net,P_test_2); % Data inverse normalization I_sim2 =

mapminmax('reverse',t_sim2,ps_ouput);

Technology

- Python108 blogs
- Java99 blogs
- Flow Chart79 blogs
- Vue52 blogs
- MySQL32 blogs
- programing language32 blogs
- javascript30 blogs
- Linux28 blogs
- more...

Daily Recommendation

views 4

©2020 ioDraw All rights reserved

python gui Interface examples -Python GUI Programming complete example IO flow —— Classification of flow ,InputStream,OutputStream,Reader,Writer etc. Thread.setDaemon Set up the Daemons STM32 RS485 modbus Communication source program , The test is effective stay MATLAB 2018 Time series prediction with deep learning vue3 Write component library and publish to npm The process of Questions and answers for the interviewer ： How did you get a project in the project team ??? In the applet form Multiple cycles input How to get each input Value of 2021 Front end high frequency interview questions （ You have to watch it !!!）js Array method