代码拉取完成,页面将自动刷新
function labels = gaussian_shaped_labels(sigma, sz)
%GAUSSIAN_SHAPED_LABELS
% Gaussian-shaped labels for all shifts of a sample.
%
% LABELS = GAUSSIAN_SHAPED_LABELS(SIGMA, SZ)
% Creates an array of labels (regression targets) for all shifts of a
% sample of dimensions SZ. The output will have size SZ, representing
% one label for each possible shift. The labels will be Gaussian-shaped,
% with the peak at 0-shift (top-left element of the array), decaying
% as the distance increases, and wrapping around at the borders.
% The Gaussian function has spatial bandwidth SIGMA.
%
% Joao F. Henriques, 2014
% http://www.isr.uc.pt/~henriques/
% %as a simple example, the limit sigma = 0 would be a Dirac delta,
% %instead of a Gaussian:
% labels = zeros(sz(1:2)); %labels for all shifted samples
% labels(1,1) = magnitude; %label for 0-shift (original sample)
%evaluate a Gaussian with the peak at the center element
[rs, cs] = ndgrid((1:sz(1)) - floor(sz(1)/2), (1:sz(2)) - floor(sz(2)/2));
labels = exp(-0.5 / sigma^2 * (rs.^2 + cs.^2));
%move the peak to the top-left, with wrap-around
labels = circshift(labels, -floor(sz(1:2) / 2) + 1);
%sanity check: make sure it's really at top-left
assert(labels(1,1) == 1)
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。