-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error during learning process #38
Comments
So the error occurs when you use jpg or png?
It seems that your data has 4 channels.
My original code is |
@williamyang1991 It was originally a png format, but I changed it to jpg, but there is still an error. I tried your original code, but it's the same! Do you think the png format is a problem? |
you can add |
Alpha Channel was the problem! Thanks for letting me know. One question is that input image is definitely channel 3, but Simg is still channel 4. Can I assume there was a malfunction in the middle? |
My code is just read the image and transform it.
It should be that you incorrectly changed png to jpg without discarding its alpah channel. |
I found this error while running finetune_dualstylegan.py in the last step of learning.
I changed it to jpg because I thought the format of the picture might be a problem, but there must be a problem.
I would appreciate it if you could tell me how to solve it.
load model: /content/drive/MyDrive/generator-pretrain.pt
Loading pSp from checkpoint: /content/drive/MyDrive/encoder.pt
Loading ResNet ArcFace
Encoder model successfully loaded!
Traceback (most recent call last):
File "finetune_dualstylegan.py", line 529, in
Simg = transform2(Simg).unsqueeze(dim=3)
File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 67, in call
img = t(img)
File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 727, in call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/transforms.py", line 226, in forward
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/usr/local/lib/python3.7/dist-packages/torchvision/transforms/functional.py", line 284, in normalize
tensor.sub(mean).div_(std)
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
The text was updated successfully, but these errors were encountered: