piwise icon indicating copy to clipboard operation
piwise copied to clipboard

No folder named "Labels", Tuple Index out of range, size mismatch.

Open NicWickman opened this issue 7 years ago • 6 comments

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.

NicWickman avatar Feb 05 '18 22:02 NicWickman

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:

  1. Did any pytorch api change?
  2. Try different indices (debug the program)?
  3. 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.

bodokaiser avatar Feb 06 '18 08:02 bodokaiser

I'm having the same issue. Did you find a solution?

SleyAI avatar May 05 '18 09:05 SleyAI

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 .

NicWickman avatar May 05 '18 10:05 NicWickman

The problem should be in transform.py. You can try deleting the lines 101 to 111 in main.py and try again.

fantasyzl avatar May 16 '18 03:05 fantasyzl

board.image(color_transform(targets[0].cpu()[0].data) will fix

guizilaile23 avatar Sep 29 '18 03:09 guizilaile23

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)

swg209 avatar Jul 31 '19 08:07 swg209