Skip to content
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

Image shape changed to 352 from 360 in FRRN camvid #250

Open
akshatgarg99 opened this issue Dec 21, 2020 · 3 comments
Open

Image shape changed to 352 from 360 in FRRN camvid #250

akshatgarg99 opened this issue Dec 21, 2020 · 3 comments

Comments

@akshatgarg99
Copy link

akshatgarg99 commented Dec 21, 2020

In Frrn for camvid, the size of the input image is 360. This is changed to 352 after up sampling at the end of encoder part mainly because it pools an image of size 45 to 22 and then upsamples it. This gives an error while adding the z of shape 360 with y having shape 352 in FRRU layer.

I guess the input dimension should be a multiple of 16

@akshatgarg99 akshatgarg99 changed the title Imahe shape changed to 352 from 360 in FRRN camvid Image shape changed to 352 from 360 in FRRN camvid Dec 21, 2020
@andrew-healey
Copy link

I'm also trying to work with CamVid. Have you also been having trouble with the transform method?

I'm trying to use the DataLoader but it gives me this error:

Traceback (most recent call last):
  File "train.py", line 229, in <module>
    train(cfg, writer, logger)
  File "train.py", line 118, in train
    for (images, labels) in trainloader:
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 336, in __next__
    return self._process_next_batch(batch)
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 106, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/content/pytorch-semseg/ptsemseg/loader/camvid_loader.py", line 57, in __getitem__
    img, lbl = self.transform(img, lbl)
  File "/content/pytorch-semseg/ptsemseg/loader/camvid_loader.py", line 74, in transform
    lbl = torch.from_numpy(lbl).long()
TypeError: can't convert np.ndarray of type numpy.int8. The only supported types are: double, float, float16, int64, int32, and uint8.

@akshatgarg99
Copy link
Author

Yeah there were some issues. I rewrote the code and now it works fine. I also used opencv to load the image. It saves me some computation and eleminated the error. I am not sure how you are loading the image. the scipy method is taken down so i used opencv. You can check out my reposetory fot the code that i wrote.

https://github.com/akshatgarg99/FRR-Net/blob/master/utils/dataLoader.py

@andrew-healey
Copy link

Thanks a lot! That's exactly what I was looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants