syfafterzy / SVDNet-for-Pedestrian-Retrieval

Code for https://arxiv.org/abs/1703.05693
138 stars 47 forks source link

For the code of SVD #2

Open zhDai opened 6 years ago

zhDai commented 6 years ago

hello, thanks for your code! But I have a doubt about the matlab code of SVD. I have seen the function of svd, but why are you to replace each weight vector with the "closest" eigen vector? Can I directly use the outcomes of svd (as W=U(:,1:Dim)*S(1:Dim,:))

syfafterzy commented 6 years ago

Please note that no matter W is replaced with US or US( which means US are aligned in any other different order), the discriminative ability remains exactly unchanged. There are two reasons to re-arrange US. First, singular vectors by numerical SVD have ambiguous +/- directions. The ambiguity does not matter to SVD itself, but matters to the projection results when $US$ are used as weight vectors. Two, the decomposition results are sequentially arranged according to the singular values, which is not steady when $W$ is changed. The position relationship of two adjacent feature vectors might be altered when $W$ changes only a little.

If you replace W with US directly, Rank-1 accuracy will be achieved at about 75% on CaffeNet and 80% on ResNet.

zhDai commented 6 years ago

ok, thanks~

wjzh1 commented 6 years ago

@zhDai @syfafterzy 请问我用的是resnet18网络,在分类层前面加了一个fc层,在用作者matlab代码转换的时候出现索引超出矩阵维度,请问要怎么修改change_resnet_W.m这代码

MSiam commented 6 years ago

Hi I was not quite sure why are you not multiplying US directly, instead of taking the first 'Dim' dimensions U(:,1:Dim)S(1:Dim,:)? Thanks,

ghost commented 6 years ago

@MSiam Because it is convenient for debugging code, thanks for attention.