NVIDIA / FastPhotoStyle

Style transfer, deep learning, feature transform
Other
11.14k stars 1.2k forks source link

SVD fails in __wct_core when cont_feat or styl_feat are [x,1] dimensional matrix #104

Open dkreinov opened 4 years ago

dkreinov commented 4 years ago

Unless I'm doing something wrong, there is a corner case inside def __wct_core, when one of the matrices is basically a vector. When calculating: contentConv = torch.mm(cont_feat, cont_feat.t()).div(cFSize[1] - 1) + iden

cFSize[1] is 1 so there is a division by 0=> and we get a matrix full of NAN which is causing the SVD to fail.

For now, as a w/a inside def __feature_wct I've changed the condtion if cont_mask[0].size <= 0 or styl_mask[0].size <= 0: continue

to

if cont_mask[0].size <= 1 or styl_mask[0].size <= 1: continue

to ignore labels that causing this issue.

Any idea why it happens and what is the best approach to fix it?

dawgster commented 2 years ago

I am also facing this issue