zhanghang1989 / PyTorch-Multi-Style-Transfer

Neural Style and MSG-Net
http://hangzh.com/PyTorch-Style-Transfer/
MIT License
977 stars 206 forks source link

test error #14

Open donghyunyoo opened 6 years ago

donghyunyoo commented 6 years ago

I got this error.

Traceback (most recent call last): File "main.py", line 290, in main() File "main.py", line 45, in main evaluate(args) File "main.py", line 258, in evaluate output = utils.color_match(output, style_v) File "/media/hdd1/donghyun/armor/PyTorch-Multi-Style-Transfer/experiments/utils.py", line 150, in color_match src_flat_nrom_trans = matSqrt(dst_flat_cov_eye) matSqrt(src_flat_cov_eye).inverse src_norm RuntimeError: mul() received an invalid combination of arguments - got (builtin_function_or_method), but expected one of:

How can I fix this?

suke27 commented 6 years ago

do you resolve it, I face similar problem src_flat_cov_eye = src_norm @ src_norm.t() + Variable(torch.eye(3).cuda())

donghyunyoo commented 6 years ago

Yes. In my case, I resolved it with this modification. src_flat_nrom_trans = matSqrt(dst_flat_cov_eye) matSqrt(src_flat_cov_eye).inverse() src_norm

suke27 commented 6 years ago

which file do you modify? @donghyunyoo

suke27 commented 6 years ago

the paper said support "Brush Stroke Size Control." do you know how to evaluate in different brush stroke size @donghyunyoo

lxy443626128 commented 6 years ago

@suke27 did you solve it?

src_flat_cov_eye = src_norm @ src_norm.t() + Variable(torch.eye(3).cuda())

suke27 commented 6 years ago

not yet

gwenguo090006 commented 6 years ago

@donghyunyoo I make the same modification as you, but then a new error occurs as follow: RuntimeError: The size of tensor a (3) must match the size of tensor b (655360) at non-singleton dimension 1 Did you ever encounter this error? I don't know if I could change the data formation of this script.

LoicEm commented 6 years ago

@gwenguo090006 I just ran into the same error, which seems to originate from the latest commit (didn't have any error before that).

The error comes from utils.color_match that is now used right before saving the output in main.py. A quick fix is for now to comment out line 258 in main.py : output = utils.color_match(output, style_v)

It seems to work for me

gwenguo090006 commented 6 years ago

@LoicEm yes, your solution is feasible. And then I step into the color_match function, I think it is used to render the output image further. The error occurs when the multiplication between two matrices . I don't know why this happened, I don' think it's a confusion of the author between element product and matrix product. But when I modify the element product to matrix product, it works. However, the result is a little different from the case when you just comment out line 258 but it's also a style-transfer result of the original image.