piwise
piwise copied to clipboard
No folder named "Labels", Tuple Index out of range, size mismatch.
First I think there's a small error in the README tutorial: Should the correct directory should be data/labels instead of data/classes ?
Anyways, I get the following traceback:
/home/nic/.conda/envs/piwise/lib/python3.6/site-packages/torch/nn/functional.py:1423: UserWarning: nn.functional.upsample_bilinear is deprecated. Use nn.functional.upsample instead.
warnings.warn("nn.functional.upsample_bilinear is deprecated. Use nn.functional.upsample instead.")
/home/nic/machineLearning/Automatter/machine-learning/piwise/piwise/criterion.py:13: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
return self.loss(F.log_softmax(outputs), targets)
Traceback (most recent call last):
File "main.py", line 163, in <module>
main(parser.parse_args())
File "main.py", line 138, in main
train(args, model)
File "main.py", line 85, in train
board.image(color_transform(outputs[0].cpu().max(0)[1].data),
File "/home/nic/machineLearning/Automatter/machine-learning/piwise/piwise/transform.py", line 48, in __call__
color_image = torch.ByteTensor(3, size[1], size[2]).fill_(0)
IndexError: tuple index out of range
My first attempt at an obvious solution was to change it to
color_image = torch.ByteTensor(3, size[0], size[1]).fill_(0)
But I still have a size mismatch error. Tensor is 256 x 256 and Mask is 256.
First I think there's a small error in the README tutorial: Should the correct directory should be data/labels instead of data/classes ?
Yes, I think it should be 'data/labels'. The README was not updated a while.
My first attempt at an obvious solution was to change it to color_image = torch.ByteTensor(3, size[0], size[1]).fill_(0) But I still have a size mismatch error. Tensor is 256 x 256 and Mask is 256.
The last time I used piwise
which was more then a year ago. It worked straight out of the box, however memories are prone to failures. Some things I would suggest:
- Did any pytorch api change?
- Try different indices (debug the program)?
- You used the Pascal VOC 2012 data?
I am not sure if this has any relevance but the color_transform
takes an image labeled 0 to 17, 255
and converts it into a color images where each label has distinct colors. The implementation was more or less copy and paste from the Matlab script Pascal VOC 2012 provides.
I'm having the same issue. Did you find a solution?
No, I have not. Sorry I'm not of more help.
On Sat, May 5, 2018, 2:30 AM henning3871, [email protected] wrote:
I have the same issue. Did you find a solution?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bodokaiser/piwise/issues/17#issuecomment-386792724, or mute the thread https://github.com/notifications/unsubscribe-auth/ASZsAXVRRshLZUAPP9BdYYkxoDoTqdWwks5tvXEegaJpZM4R6LNt .
The problem should be in transform.py. You can try deleting the lines 101 to 111 in main.py and try again.
board.image(color_transform(targets[0].cpu()[0].data) will fix
This is caused by the gray_image 's axis, after add this line code
gray_image = gray_image.view(1,256,256)
in transform.py line 47,
the issue is solved.
def __call__(self, gray_image):
gray_image = gray_image.view(1,256,256)
size = gray_image.size()
color_image = torch.ByteTensor(3, size[1], size[2]).fill_(0)