Closed AhmedHashish123 closed 2 years ago
Maybe you can run pimg, parse, from_pose = load_img(pid, ds)
and print the size
and type
for pimg, parse, from_pose
to first check whether all the data are loaded properly?
pimg size: torch.Size([3, 256, 176]) pimg type<class 'torch.Tensor'> parse size: torch.Size([256, 176]) parse type: <class 'torch.Tensor'> from_pose size: torch.Size([18, 256, 176]) from_pose type: <class 'torch.Tensor'>
I believe the problem with the first error { TypeError: ne() received an invalid combination of arguments - got (NoneType), but expected one of:
(Tensor other) didn't match because some of the arguments have invalid types: (!NoneType!) (Number other) didn't match because some of the arguments have invalid types: (!NoneType!) } is that a tensor is being compared to a None type { if pose != None: }
These are the variables that caused the second error:
gimg: tensor([[[0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], ..., [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7490, 0.7490]],
[[0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863],
[0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863],
[0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863],
...,
[0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647],
[0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647],
[0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7647, 0.7647]],
[[0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784],
[0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784],
[0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784],
...,
[0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569],
[0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569],
[0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7569, 0.7569]]],
device='cuda:0')
gimg type: <class 'torch.Tensor'> gparse: tensor([[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]], device='cuda:0', dtype=torch.uint8) gparse type: <class 'torch.Tensor'> gid[2]: 5 gid[2] type: <class 'int'>
The error is in this line: { gimgs += [gimg * (gparse == gid[2])] }
RuntimeError: expected type torch.cuda.FloatTensor but got torch.cuda.ByteTensor
pimg size: torch.Size([3, 256, 176]) pimg type<class 'torch.Tensor'> parse size: torch.Size([256, 176]) parse type: <class 'torch.Tensor'> from_pose size: torch.Size([18, 256, 176]) from_pose type: <class 'torch.Tensor'>
I believe the problem with the first error { TypeError: ne() received an invalid combination of arguments - got (NoneType), but expected one of:
(Tensor other) didn't match because some of the arguments have invalid types: (!NoneType!) (Number other) didn't match because some of the arguments have invalid types: (!NoneType!) } is that a tensor is being compared to a None type { if pose != None: }
This can be solved by changing if pose != None
to if type(pose) != type(None)
in the plot_image
funciton in the demo.ipynb
.
These are the variables that caused the second error:
gimg: tensor([[[0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], ..., [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7490, 0.7490]],
[[0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], [0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], [0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], ..., [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647], [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647], [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7647, 0.7647]], [[0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], [0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], [0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], ..., [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569], [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569], [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7569, 0.7569]]], device='cuda:0')
gimg type: <class 'torch.Tensor'> gparse: tensor([[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]], device='cuda:0', dtype=torch.uint8) gparse type: <class 'torch.Tensor'> gid[2]: 5 gid[2] type: <class 'int'>
The error is in this line: { gimgs += [gimg * (gparse == gid[2])] }
RuntimeError: expected type torch.cuda.FloatTensor but got torch.cuda.ByteTensor
Modifying gimgs += [gimg * (gparse == gid[2])]
to gimgs += [gimg * (gparse == gid[2]).to(torch.float32)]
can fix this error.
These are the variables that caused the second error: gimg: tensor([[[0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], [0.7569, 0.7569, 0.7569, ..., 0.6706, 0.6706, 0.6706], ..., [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7412, 0.7490], [0.7961, 0.7961, 0.7961, ..., 0.7490, 0.7490, 0.7490]],
[[0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], [0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], [0.7569, 0.7569, 0.7569, ..., 0.6863, 0.6863, 0.6863], ..., [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647], [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7569, 0.7647], [0.7961, 0.7961, 0.7961, ..., 0.7647, 0.7647, 0.7647]], [[0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], [0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], [0.7569, 0.7569, 0.7412, ..., 0.6784, 0.6784, 0.6784], ..., [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569], [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7490, 0.7569], [0.7961, 0.7961, 0.7961, ..., 0.7569, 0.7569, 0.7569]]], device='cuda:0')
gimg type: <class 'torch.Tensor'> gparse: tensor([[0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], ..., [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0], [0, 0, 0, ..., 0, 0, 0]], device='cuda:0', dtype=torch.uint8) gparse type: <class 'torch.Tensor'> gid[2]: 5 gid[2] type: <class 'int'> The error is in this line: { gimgs += [gimg * (gparse == gid[2])] } RuntimeError: expected type torch.cuda.FloatTensor but got torch.cuda.ByteTensor
Modifying
gimgs += [gimg * (gparse == gid[2])]
togimgs += [gimg * (gparse == gid[2]).to(torch.float32)]
can fix this error.
Thank you. I will try your solutions. I will close the issue in the mean time and reopen it if the solution doesn't work.
Hello,I had the same problem as you and tried the solutions above without success. Have you successfully solved it now?I really need your help, thank you!
Hello, I have reached the sections below "Setup" in the demo, but they produce an error when I try to run them.
"Pose Transfer" produces the following: TypeError Traceback (most recent call last)