akTwelve/YOLACT-tutorial

when trying train on custom data set i am unable to train due to this error.Please help

SV-18 opened this issue · 1 comments

SV-18 commented

Traceback (most recent call last):
File "train.py", line 504, in
train()
File "train.py", line 270, in train
for datum in data_loader:
File "/home/avs/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 345, in next
data = self._next_data()
File "/home/avs/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 856, in _next_data
return self._process_data(data)
File "/home/avs/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 881, in _process_data
data.reraise()
File "/home/avs/.local/lib/python3.6/site-packages/torch/_utils.py", line 394, in reraise
raise self.exc_type(msg)
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/avs/.local/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "/home/avs/.local/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/avs/.local/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/avs/Documents/yolact-master/data/coco.py", line 94, in getitem
im, gt, masks, h, w, num_crowds = self.pull_item(index)
File "/home/avs/Documents/yolact-master/data/coco.py", line 153, in pull_item
target = self.target_transform(target, width, height)
File "/home/avs/Documents/yolact-master/data/coco.py", line 42, in call
label_idx = self.label_map[label_idx] - 1
KeyError: 0

SV-18 commented

i fixed it by changing the config file to { 0: 1, 1: 2} since in my dataset the json file starts from 0.thank you