meetps/pytorch-semseg

TypeError: an integer is required (got type str) How to resolve this error?

zhengsz12 opened this issue · 0 comments

Traceback (most recent call last):
File "train.py", line 229, in
train(cfg, writer, logger)
File "train.py", line 118, in train
for (images, labels) in trainloader:
File "/home/zheng/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 336, in next
return self._process_next_batch(batch)
File "/home/zheng/.local/lib/python3.5/site-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 "/home/zheng/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/zheng/.local/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 106, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/zheng/pytorch-semseg/ptsemseg/loader/pascal_voc_loader.py", line 94, in getitem
im, lbl = self.transform(im, lbl)
File "/home/zheng/pytorch-semseg/ptsemseg/loader/pascal_voc_loader.py", line 101, in transform
img = img.resize((self.img_size[0], self.img_size[1])) # uint8 with RGB mode
File "/home/zheng/.local/lib/python3.5/site-packages/PIL/Image.py", line 1873, in resize
return self._new(self.im.resize(size, resample, box))
TypeError: an integer is required (got type str)