博主大大你好,我在使用fasterrcnn训练自己的数据集时出现了这个错误,请问改如何解决:
Traceback (most recent call last):
File "D:/PROJECT/faster_rcnn/train_res50_fpn.py", line 231, in
main(args)
File "D:/PROJECT/faster_rcnn/train_res50_fpn.py", line 144, in main
scaler=scaler)
File "D:\PROJECT\faster_rcnn\train_utils\train_eval_utils.py", line 27, in train_one_epoch
for i, [images, targets] in enumerate(metric_logger.log_every(data_loader, print_freq, header)):
File "D:\PROJECT\faster_rcnn\train_utils\distributed_utils.py", line 204, in log_every
for obj in iterable:
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\PROJECT\faster_rcnn\my_dataset.py", line 91, in getitem
labels.append(self.class_dict[obj["name"]])
KeyError: 'rats '
博主大大你好,我在使用fasterrcnn训练自己的数据集时出现了这个错误,请问改如何解决: Traceback (most recent call last): File "D:/PROJECT/faster_rcnn/train_res50_fpn.py", line 231, in
main(args)
File "D:/PROJECT/faster_rcnn/train_res50_fpn.py", line 144, in main
scaler=scaler)
File "D:\PROJECT\faster_rcnn\train_utils\train_eval_utils.py", line 27, in train_one_epoch
for i, [images, targets] in enumerate(metric_logger.log_every(data_loader, print_freq, header)):
File "D:\PROJECT\faster_rcnn\train_utils\distributed_utils.py", line 204, in log_every
for obj in iterable:
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\Anconda\envs\fasterrcnn\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\PROJECT\faster_rcnn\my_dataset.py", line 91, in getitem
labels.append(self.class_dict[obj["name"]])
KeyError: 'rats '