Open akshatgarg99 opened 3 years ago
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.
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
Thanks a lot! That's exactly what I was looking for.
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