train an alexnet with 2D spectrogram images
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Manish
2025 年 1 月 5 日
編集済み: Manish
2025 年 1 月 5 日
Hi Yasaman,
I understand that you want to train an AlexNet with 2D spectrogram images.You can achieve the same with the help of transfer learning.
Transfer learning is commonly used in deep learning applications. You can take a pretrained network and use it as a starting point to learn a new task. Fine-tuning a network with transfer learning is usually much faster and easier than training a network with randomly initialized weights from scratch.
Refer the link below for better understanding:
Hope it helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!