% Softmax temporal pooling method
% omtp = temppool_softmax(om, p)
% om vector of objective metric scores for each frame
% p parameter, gives tranisition from mean to max pooling
% p = 0 => mean pooling
% p = Inf => max pooling
% taken from Y. Boureau et al., A Theoretical Analysis of Feature Pooling in
% Visual Recognition, Proc. 27th Intntl Conf on Machine Learning, 2010
function omtp = temppool_softmax(om, p)
    if ~isvector(om)
        error('Input om must be a vector')
    end
    if ~isscalar(p) || p < 0
        error('Input p must not be a negative scalar')
    end
    [a,b] = size(om);
    if a > b
        om = om';
    end
    expvec = exp(om.*p);
    omtp = sum((expvec./sum(expvec)).*om);