% create a MIL dataset from the original WAV-files, segmentation of the % spectrograms, and computation of features on the segmented regions % some settings: windowlen = 512; fmax = 256; intens_thr = 0.8; % remove 80% of the signal?? f_min = 2000; % frequency threshold (everything below is removed) % load the 'meta' data like labels and filenames dpath = fullfile(mildatapath,'birds'); [bagid,names] = textread(fullfile(dpath,'id2filename.txt'),'%n%s','headerlines',1); [bagid2,labstr] = textread(fullfile(dpath,'hja_birdsong_bag_labels.txt'),'%n%s','headerlines',1); if any(bagid~=bagid2) error('Bagid''s do not match.'); end G = fspecial('gaussian',[5 5],2); % 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 %load the signal; [signal,fs] = wavread(fullfile(dpath,'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