ProGamerGov / neural-style-pt

PyTorch implementation of neural style transfer algorithm
MIT License
834 stars 178 forks source link

AttributeError: 'list' object has no attribute 'double' in normalizing tendor #13

Closed GhostBuster99 closed 4 years ago

GhostBuster99 commented 5 years ago

When running the script I run into the following error. All goes well until the normalize call on the tensor. Hope this is enough logging to be of help:

VGG-19 Architecture Detected Successfully loaded models/vgg19-d01eb7cb.pth conv1_1: 64 3 3 3 conv1_2: 64 64 3 3 conv2_1: 128 64 3 3 conv2_2: 128 128 3 3 conv3_1: 256 128 3 3 conv3_2: 256 256 3 3 conv3_3: 256 256 3 3 conv3_4: 256 256 3 3 conv4_1: 512 256 3 3 conv4_2: 512 512 3 3 conv4_3: 512 512 3 3 conv4_4: 512 512 3 3 conv5_1: 512 512 3 3 conv5_2: 512 512 3 3 conv5_3: 512 512 3 3 conv5_4: 512 512 3 3 Traceback (most recent call last): File "neural_style.py", line 409, in main() File "neural_style.py", line 58, in main content_image = preprocess(params.content_image, params.image_size).type(dtype) File "neural_style.py", line 293, in preprocess tensor = Normalize(rgb2bgr(Loader(image) * 256)).unsqueeze(0) File "C:\Users\Rwar\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 61, in call img = t(img) File "C:\Users\Rwar\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py", line 164, in call return F.normalize(tensor, self.mean.double(), self.std.double(), self.inplace) AttributeError: 'list' object has no attribute 'double' PS C:\WS\neural-style-pt>

ProGamerGov commented 5 years ago

@GhostBuster99 What version of Python were you using?

I just tested it with Python 2.7, and didn't get the same error.

Looks like it could have been an accidental error in the PyTorch code that's been fixed: https://github.com/pytorch/vision/pull/1021? What version of PyTorch are you using?