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