Matlab Neural Network Sim function configuration

1 view (last 30 days)
I want to model the sea surface Chlorophyll (Chl) concentration using satellite imagery. For this purpose I obtained satellite images and the ground measured Chl data for the same dates. The satellite data represent the satellite measured reflectance from water surface in four different wavelengths. To develop a relationship between the satellite measured reflectance and Chl-a, Neural Network (NN) technique is used. A NN is developed which contains 1 input layer with 4 neurons (each neuron represents the reflectance from each wavelengths), 1 hidden layer with 3 neurons and 1 output layer with 1 neuron (representing estimated Chl-a concentration). After training the network several times, the NN was tested for its performance by Simulating (Sim NET) some independent data and results seemed to be satisfactory. For a simple matrix (X) having 4 inputs (each representing reflectance from one of the 4 wavelengths) corresponding to 2 samples the simulation function can be written as given in Equation 1 which yield a single output Y for each sample.
Sim (net, X) --------- Equation (1)
But, how I can write a similar "Simulate" function for a .tif image which has four layers each representing the reflectance from a different wavelength. Image dimensions are 129x153x4, means the image has 4 layers (wavelengths) in which each layer has 129 rows and 153 columns. In each layer, the first element of row 1 and column 1 represents the corresponding reflectance value from the first pixel. The Sim function should run on each pixel of the image. For input, the Sim function should take the value of 1st pixel from 1st layer as Input1, 1st pixel from 2nd layer as Input2, 1st pixel from 3rd layer as Input3, and 1st pixel from 4th layer as Input4. And this process should run on all the pixels.

Accepted Answer

Greg Heath
Greg Heath on 19 Aug 2014
You have to convert the A3D(129x153x4) into A2D(4x(129*153))
Currently, I do not know how to do this. I tried using the function permute on A = rand(5,6,4) to obtain B(4,30) but was unsuccessful.
I suggest you solve this easier problem first.
Hope tis helps.
Greg
  2 Comments
Majid Nazeer
Majid Nazeer on 19 Aug 2014
Thanks Greg,
I can separate each layer its not a problem. After separation I have four layers each having dimension 129x453, representing one of the four wavelengths. Can you help me, how can I configure the "Sim NET" function for these layers as described in the above question?
Thanks

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 19 Aug 2014
If size(L1) = [ 129 153 ] and similarly for L2, L3 and L4:
input = [ L1(:)' ; L2(:)' ; L3(:)' ; L4(:)' ];
output = net(input); % or the obsolete output = sim(net,input);
  3 Comments
Majid Nazeer
Majid Nazeer on 20 Aug 2014
Dear Greg, Can I save the output in a .tif file which should have same dimensions as the input file had i.e. 129x153?
Greg Heath
Greg Heath on 20 Aug 2014
Yes
help reshape
doc reshape
type reshape
will get you started

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!