How can I add vggish features to the array?

1 回表示 (過去 30 日間)
Dawid Kosior
Dawid Kosior 2021 年 4 月 19 日
回答済み: Abhishek Gupta 2021 年 4 月 22 日
Hi. I have about 5k of .wav files and want to pass them through vggishFeatures. Then I would like to add every feature to the array, this array to .csv or something and use it in Python. Sizes of these features are not fixed so there's another problem with it for me. Any ideas how can I perform it? Did it as below, but doesn't work as it should:
label = [];
ficz = [];
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
% read audio and get feats
[audioIn,fs] = audioread(fullFileName);
featureVectors = vggishFeatures(audioIn,fs);
fV = featureVectors(:)
ficz(:,end+1) = fV;
end
csvwrite('ficzury/VGGish/VGGish_feats.csv',ficz)
csvwrite('ficzury/y_VGGish.csv',label)

回答 (1 件)

Abhishek Gupta
Abhishek Gupta 2021 年 4 月 22 日
Hi,
As per my understanding, you want to write variable size arrays (feature vectors) to a CSV file. You can do the same as follows:-
ficz = [];
for k = 1:length(theFiles)
%---Your Code Here---%
ficz{end+1} = fV;
end
writecell(ficz','ficzury/VGGish/VGGish_feats.csv');
For more information, check out the MATLAB documentation link below: -

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by