% create a MIL dataset from the original WAV-files, segmentation of the % spectrograms, and computation of features on the segmented regions % % This is the new 19 species dataset from the MLSP competition % some settings: windowlen = 512; fmax = 256; intens_thr = 0.8; % remove 80% of the signal?? f_min = 2000; % frequency threshold (everything below is removed) % blurring of the spectrogram: G = fspecial('gaussian',[5 5],2); % load the 'meta' data like labels and filenames %dpath = '../birds_mlsp2013/mlsp_contest_dataset/essential_data/'; dpath = '/data/birds_mlsp2013/mlsp_contest_dataset2/essential_data'; % load the filenames fid = fopen(fullfile(dpath,'rec_id2filename.txt')); data = textscan(fid,'%n%s','headerlines',1); fclose(fid); bagid = data{1}; names = data{2}; % next load the labels: fid = fopen(fullfile(dpath,'rec_labels_test_hidden.txt')); data = textscan(fid,'%n%s','headerlines',1); bagid2 = data{1}; labstr = data{2}; % load the indices for the training and test objects: N = length(bagid2); CVfile = fopen(fullfile(dpath,'CVfolds_2.txt')); CVdata = textscan(CVfile, '%f,%f', N, 'headerlines',1); fclose(CVfile); bagid3 = CVdata{1}; Itst = CVdata{2}; % some checking if any(bagid~=bagid2) error('Bagid''s do not match.'); end % run over the files, and get the features: B = size(bagid,1); x = cell(B,1); baglab = zeros(B,13); instlab = ''; bagid = []; for i=1:B i %load the signal; [signal,fs] = wavread(fullfile(dpath,'src_wavs',names{i}(2:end))); [S,f,t] = spectrogram(signal,windowlen,windowlen/2,fmax,fs); % smooth and threshold the spectrogram: I = imfilter(abs(S),G,'same'); mask = (I>dd_threshold(I(:),intens_thr)); mask(f