train an alexnet with 2D spectrogram images
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a dataset that has 8528 .mat files(they are ECG recorded signals). I want to extract deep features of each signal from spectrograms of the signals and then feed the spectrograms images as 2D input images into an alexnet to classify the signals by their labels. How can I do this?
( my Matlab version is 2017b)
here is a piece of my code:
Data=importdata ('REFERENCE-original.csv') ;
%% features extraction
numbers_of_data=length(Data);
deep_net = alexnet;
deep_layer = 'fc8'; % CNN network
lgraph = layerGraph(deep_net.Layers);
figure
plot(lgraph)
title('AlexNet CNN ' )
for data_number =1:numbers_of_data
clc
data_number
numbers_of_data
name=Data{data_number,1}(1:6);
N_label=Data{data_number,1}(8);
data =load (['D:\dataset\train2017\',name,'.mat']);
signal=data.val;
DATA{data_number}=signal;
% normal=0 af=1
if N_label~='A'
label(data_number)=0;
end
if N_label=='A'
label(data_number)=1;
end
end
fs = 300;
figure(10)
pspectrum(signal,fs,'spectrogram');
F = getframe(gcf);
[im, Map] = frame2im(F);
im = imresize(im,[227 227]);
deep_features = activations( deep_net,im, deep_layer);
deep_features_matrix(:,:,:,data_number)=deep_features;
deep_features_matrix(isnan(deep_features_matrix))=0;
%% label
% other=0 af=1
targetD1=categorical([label])';
end
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!