MATLAB Answers

0

How can I avoid one results in CNN

Asked by Jaewon Kim on 12 Jul 2018 at 11:47
Latest activity Commented on by Jaewon Kim on 17 Jul 2018 at 2:15

Hello

I have 7000 data that it is CSV file and 1-D (1*125)

the value in cells over 0 under 1.

it is divided into 17 categories, also divided into Training data(90%) and Test data(10%), randomly.

I want to make CNN net using this data.

And my code is like below

% Import data
HSdata = imageDatastore('C:\Users\lovel\OneDrive\Research\Deep learning stuff\Deep learning normalization\Seperation','Readfcn',@readDatastoreCSV,'IncludeSubfolders',true,'LabelSource','foldernames','FileExtensions','.csv')
% labeling the names
rocknames = HSdata.Labels
% Dividing into Training Data and Testing Data
[HSdataTraining,HSdataTesting] = splitEachLabel(HSdata,0.9,'randomized')
%layers
  layers=[
          imageInputLayer([1 125]); 
          convolution2dLayer([1 3],64,'Stride',1,'Padding',1);
          convolution2dLayer([1 3],64,'Stride',1,'Padding',1);
          reluLayer(); 
          maxPooling2dLayer([1 2],'Stride',2);
          convolution2dLayer([1 3],128,'Stride',1,'Padding',1);
          convolution2dLayer([1 3],128,'Stride',1,'Padding',1);
          reluLayer();
          maxPooling2dLayer([1 2],'Stride',2);
          convolution2dLayer([1 3],256,'Stride',1,'Padding',1);
          convolution2dLayer([1 3],256,'Stride',1,'Padding',1);
          reluLayer();
          maxPooling2dLayer([1 2],'Stride',2);
          fullyConnectedLayer(400);
          fullyConnectedLayer(400);
          fullyConnectedLayer(17);
          softmaxLayer();
          classificationLayer();
          ];
        %option
        options = trainingOptions('sgdm' ,'ExecutionEnvironment','GPU')
        [HSdatanet,info] = trainNetwork(HSdataTraining,layers,options);

And I tested that net using Test data(10% of whole data).

The predicted data is just one result.

I really want to know the problem.

  9 Comments

There is clearly something wrong but I can't put my finger on it, sorry. The best I can do is to suggest you have a look at this thread and the answer by Mathworker Joss Knight, whose suggested workflow I managed to replicate a couple of weeks ago. So, I have to say, it does work, and maybe if you adapt his workflow to your own, you might be able to find out what went wrong in the first place. Good luck.

"The predicted data is just one result" doesn't make much sense. If you are calling predict or classify with 700 observations then you must get 700 results. Let's take a look at exactly what is in your test data, and exactly what your code is that you are using to predict on your test data.

Dear Knight and Duesenberg.

I solved this problem. the problem was the maxpooling. I have to use the stride of maxpooling is 1D (1*2 or 1*3)

thanks for your attention!

And I want to say that the predicted data was the same results, not "The predicted data is just one result". it means there are 700 test data, then there was also 700 scores of each data. Sorry for making you confused.

Sign in to comment.

0 Answers