function hist = get_BoW_descriptor(descrs, model)

numWords = size(model.vocab, 2) ;

% [drop, binsa] = min(vl_alldist(model.vocab, descrs), [], 1) ;
binsa = double(vl_kdtreequery(model.kdtree, model.vocab, ...
                                descrs, ...
                                'MaxComparisons', 15)) ;
bins = sub2ind([numWords, 1], binsa);
% hist = zeros(numWords, 1);
% hist = vl_binsum(hist, ones(size(bins)), bins);
hist = sparse(bins, 1, 1, numWords, 1);
hist = hist / sqrt(sum(hist.^2));
