gaobb / DLDL

[TIP] Deep Label Distribution Learning with Label Ambiguity

Home Page:http://lamda.nju.edu.cn/gaobb/projects/DLDL.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请问利用label和高斯分布生成一个 label distribution的方法都在哪里?matlab深度学习代码太不熟悉了

Sean-asc opened this issue · comments

commented
请问利用label和高斯分布生成一个 label distribution的方法都在哪里?matlab深度学习代码太不熟悉了

谢谢关注我们的工作。
年龄估计:

DLDL/Age-Pose/dldl_age.m

Lines 142 to 147 in 0f53197

case 'MORPH_Album2'
img_label = 1./(sqrt(2*pi)*opts.sigma).*exp(-dif_age.^2./(2*opts.sigma.^2));
case 'ChaLearn'
sigma = label(2,:);
img_label =1./repmat(sqrt(2*pi)*sigma,ld_num,1).*...
exp(-(bsxfun(@minus,opts.label_set',repmat(label(1,:),ld_num,1))).^2./repmat(2*sigma.^2,ld_num,1));

头部姿态:

DLDL/Age-Pose/dldl_pose.m

Lines 159 to 187 in 0f53197

case {'point04','bjut-3d'}
labels = [];
for i =1 : numel(imdb.images.label)
dif_cor = bsxfun(@minus, true_label(i,:) , cordin);
t = zeros(93,1);
if sigma ~= 0
t = exp(-0.5*(dif_cor(:,1).*dif_cor(:,1)+dif_cor(:,2).*dif_cor(:,2))./sigma^2);
else
t(imdb.images.label(i)) = 1;
end
labels(:,i) = t./sum(t);
imdb.images.label = max(min(labels,1-10^-15),10^-15);
end
case 'aflw_det'
cordin_yaw = repmat(-90:3:90,61,1);
cordin_pitch = repmat([90:-3:-90]',1,61);
cordin = [reshape(cordin_yaw,[],1),reshape(cordin_pitch,[],1)];
for i =1 : numel(true_label(1,:))
dif_cor = bsxfun(@minus, true_label(:,i)' ,cordin);
if sigma ~= 0
%sigma = 2;
t = exp(-0.5*(dif_cor(:,1).*dif_cor(:,1)./(2*sigma^2)+dif_cor(:,2).*dif_cor(:,2)./sigma^2));
else
t(imdb.images.label(i)) = 1;
end
labels(:,i) = t./sum(t);
end

多标签:

DLDL/utils/IFDLDLNet.m

Lines 187 to 192 in 0f53197

ind = find(labels_ld ==0);
labels_ld(ind) = opts.PD;
ind = find(labels_ld ==-1);
labels_ld(ind) = 0;
labels_ld = bsxfun(@times,labels_ld,1./sum(labels_ld));
imdb.images.labels_ld = (1-0.01).*labels_ld + 0.01/20;

语义分割:
rgbPath = sprintf(imdb.paths.image, imdb.images.name{images(i)}) ;
labelsPath = sprintf(imdb.paths.classSegmentation, imdb.images.name{images(i)}) ;
rgb = vl_imreadjpeg({rgbPath}) ;
rgb = rgb{1} ;
if opts.useGpu
anno = gpuArray(single(imread(labelsPath)));
end
h = size(anno,1);
w = size(anno,2);
conv_ld = gpuArray(zeros(h,w,21));
for ci = 0:20
feat =single( anno==ci);
x = vl_nnconv(feat, kernel, [], ...
'pad',2, ...
'stride', 1,...
'CuDNN' ) ;
x (1:2,:) = feat(1:2,:);
x(end-1:end,:) = feat(end-1:end,:);
x(:,1:2) = feat(:,1:2);
x(:,end-1:end) = feat(:,end-1:end);
conv_ld(:,:,ci+1) = x;
end
conv_ld = bsxfun(@times,conv_ld,1./sum(conv_ld,3));
conv_ld(isnan(conv_ld)) = 0;
anno_ld = gather(conv_ld);
anno_ld(:,:,22) = gather(anno);

commented