ybsong00/Vital_release

寻求帮助

22wei22 opened this issue · 6 comments

net_G = G_pretrain(net_fc, net_G, neg_data, opts_net);
为什么用负样本初始化G,而不是用正样本初始化G

Thanks for the question. We have updated and set positive samples to initialize G.

请问就是我们log(D(G(C)*C))这个损失函数是在代码哪里体现的?是在mdnet_finetune_hnm_update.m
这部分代码体现的么?为什么要把G(C)的9个数中3个最小的数值位置都设置为0,谢谢
%----------------------------yb added---------------------------
batch_asdn=pos_data(:,:,:,train_pos((t-1)opts.batch_pos+1:topts.batch_pos));
if opts.useGpu
batch_asdn = gpuArray(batch_asdn) ;
end

res_asdn=vl_simplenn(net_asdn,batch_asdn,[],res_asdn,...
        'disableDropout', true, ...
        'conserveMemory', opts.conserveMemory, ...
        'sync', opts.sync);
feat_asdn=squeeze(gather(res_asdn(end-1).x(:,:,1,:))); 
         
num=size(feat_asdn,3);
mask_asdn=ones(3,3,512,num,'single');
for i=1:num
    feat_=feat_asdn(:,:,i);
    featlist=reshape(feat_,9,1);
    [~,idlist]=sort(featlist,'ascend'); 
    idxlist=idlist(1:3);
    
    for k=1:length(idxlist)
        idx=idxlist(k);
        row=floor((idx-1)/3)+1;
        col=mod((idx-1),3)+1;
        mask_asdn(col,row,:,i)=0;
    end
end
batch_asdn=batch_asdn.*mask_asdn; 

@22wei22 Here is the dropout operation where the input positive features are filtered by the generated mask. Note that we sort the importance of channel in an ascent way. It means that we pick up the channels minimizing the G's loss, which corresponds to maximizing the D's loss. The detailed setting of numbers is picked empirically.

我想问一下,就是一直使用M*C的直接训练不好么,就是使用最干扰的特征·一直训练,这样感觉判别器学习得的更厉害。是因为M是提供了一个相对好的初始解,就是为了让网络学习到G(C),这样的G(C)更加地柔和,可以更好地来让G(C)学习出什么是最干扰的特征,这样理解可以么?

Good question. You are right. M*C can be interpreted as a good initialization of the mask while being further improved through adversarial learning. In theory, the mask should be randomly initialized but we find that it is difficult to train the G and D in practice. So picking up the channels deteriorating the performance most is an implementation trick which facilitates the adversarial learning of both G and D.

Doesn't the released code use the costSensitiveloss shown in the paper? I find the costSensitiveloss.m is same to the original vl_nnsoftmaxloss.m.