Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

labels.append(self.class_dict[obj["name"]]) KeyError: 'rats ' #833

Open
LY06-10 opened this issue Aug 30, 2024 · 1 comment
Open

labels.append(self.class_dict[obj["name"]]) KeyError: 'rats ' #833

LY06-10 opened this issue Aug 30, 2024 · 1 comment

Comments

@LY06-10
Copy link

LY06-10 commented Aug 30, 2024

博主大大你好,我在使用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 '

@hugyan
Copy link

hugyan commented Nov 7, 2024

请问您解决了吗,我也是这种情况

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants