VainF / DeepLabV3Plus-Pytorch

Pretrained DeepLabv3 and DeepLabv3+ for Pascal VOC & Cityscapes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when running main.py with default parameters

ChangzhenZhang opened this issue · comments

The error message is as follows:

Traceback (most recent call last):
  File "main.py", line 383, in <module>
    main()
  File "main.py", line 327, in main
    for (images, labels) in train_loader:
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 363, in __next__
    data = self._next_data()
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 989, in _next_data
    return self._process_data(data)
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1014, in _process_data
    data.reraise()
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/_utils.py", line 395, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/username/.local/lib/python3.6/site-packages/PIL/ImagePalette.py", line 121, in getcolor
    return self.colors[color]
KeyError: (0,)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/username/DeepLabV3Plus-Pytorch/datasets/voc.py", line 147, in __getitem__
    img, target = self.transform(img, target)
  File "/home/username/DeepLabV3Plus-Pytorch/utils/ext_transforms.py", line 57, in __call__
    img, lbl = t(img, lbl)
  File "/home/username/DeepLabV3Plus-Pytorch/utils/ext_transforms.py", line 391, in __call__
    lbl = F.pad(lbl, padding=int((1 + self.size[0] - lbl.size[1]) / 2))
  File "/home/username/.conda/envs/py36/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 403, in pad
    image = ImageOps.expand(img, border=padding, fill=fill)
  File "/home/username/.local/lib/python3.6/site-packages/PIL/ImageOps.py", line 401, in expand
    color = palette.getcolor(color)
  File "/home/username/.local/lib/python3.6/site-packages/PIL/ImagePalette.py", line 143, in getcolor
    raise ValueError("cannot allocate more than 256 colors") from e
ValueError: cannot allocate more than 256 colors

According to the error message, I think the program made an error in processing the label images, but I don't know how to fix it.

commented

I have same error ,do you have known how to solve it?