Deep learning with non-image data

Due to my current work related to detection, and the raw data are GPR traces, So I want to use non-image to train the deep models.

1 How?

    The start is diffcult,fortunetely, I follow the example of Matlab 

see"https://www.mathworks.com/help/deeplearning/examples/deep-learning-speech-recognition.html"

Thus you can understand how to prepare the data and train the model

2Try

DP model

sz = size(XTrain);
specSize = sz(1:2);
imageSize = [specSize 1];


classWeights = 1./countcats(YTrain);
classWeights = classWeights'/mean(classWeights);
numClasses = numel(categories(YTrain));

timePoolSize = ceil(imageSize(2)/8);
dropoutProb = 0.2;
numF = 12;
layers = [
    imageInputLayer(imageSize)

    convolution2dLayer(3,numF,'Padding','same')
    batchNormalizationLayer
    reluLayer

    maxPooling2dLayer(3,'Stride',2,'Padding','same')

    convolution2dLayer(3,2*numF,'Padding','same')
    batchNormalizationLayer
    reluLayer

    maxPooling2dLayer(3,'Stride',2,'Padding','same')

    convolution2dLayer(3,4*numF,'Padding','same')
    batchNormalizationLayer
    reluLayer

    maxPooling2dLayer(3,'Stride',2,'Padding','same')

    convolution2dLayer(3,4*numF,'Padding','same')
    batchNormalizationLayer
    reluLayer
    convolution2dLayer(3,4*numF,'Padding','same')
    batchNormalizationLayer
    reluLayer

    maxPooling2dLayer([1 timePoolSize])

    dropoutLayer(dropoutProb)
    fullyConnectedLayer(numClasses)
    softmaxLayer
    weightedClassificationLayer(classWeights)];

 

 

 

 Traind data:4D array

My problem is how to construct the dataset. I upload the code for you.

Mdata and MYlabel are the raw dataset.

%histogram(MYlabel)
p1=0.8; % 80% for the traindataset
 num=size(Mdata,4);num1=round(num*p1);
 p=randperm(num,num1);
XTrain=Mdata(:,:,1,p);
size(XTrain)
YTrain=MYlabel(p);
 psort=sort(p);
 
 j=1;n=0;
 
 for i=1:8215*2
     if j<=length(psort)
         if i==psort(j)             
             j=j+1;% compare
         else
             n=n+1;
             ptest(n)=i;
         end
     else
          n=n+1;
          ptest(n)=i;
     end         
 end 
 %set Validation dataset
 XValidation=zeros([100,60,1,round(num*(1-p1))],'single');
 
     XValidation=Mdata(:,:,1,ptest);
     YValidation=MYlabel(ptest);

 

Train result seems good(not easy to upload the image)

 

3 Result

Training error: 0.35758%
Validation error: 1.3086%

 

Single-image prediction time on CPU: 6.3877 ms

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

做一个码农都是奢望

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值