| Description |
This code calculates the (windowed!) running mean and variance as well as
the windowed Gaussian surprise for each newly added element.
A simple (and useless) usage example:
data=rand(1,100); % randomly generate 100 1-D samples
history_length=10; % use a window size of 10 samples
[s1,m1,v1]=gaussian_windowed_surprise_ring_buffer(data,history_length);
where m1 is the running window mean, v1 is the variance in the window,
and s1 is the windowed Gaussian surprise (novelty, saliency,
interestingness, wow, ...).
Here is another example on how we can (very simply) calculate the
auditory surprise / acoustic surprise similar to the approach presented
in [1] (also see/run example_surprise.m):
T = 0:0.001:2;
X = [chirp(T,100,1,200,'q') chirp(T,100,1,200,'q')];
Y=spectrogram(X,128,120,128,1E3);
Z=abs(Y);
surprise=mean(gaussian_windowed_surprise_ring_buffer(Z,10));
figure('name','Demo: Surprise of the double chirp signal');
plot(surprise);
However, in real applications you need to choose, e.g., a meaningful
frequency range and window length. Furthermore, please consider that the
values for the first elements (i.e., the first history_size-1 elements)
are wrong/broken and should be treated accordingly.
Please see [1] for details and an application of the Gaussian windowed
surprise and be so kind to cite [1], if you use the provided code.
[1] B. Schauerte, B. Kuehn, K. Kroschel, R. Stiefelhagen, "Multimodal
Saliency-based Attention for Object-based Scene Analysis," in Proc.
Int. Conf. Intelligent Robots and Systems (IROS), 2011.
(Please note that this is NOT the [reference/original] implementation
that was applied in [1] and there ARE differences in the results due to
different calculations/algorithms.) |