WZMIAOMIAO / deep-learning-for-image-processing

deep learning for image processing including classification and object-detection etc.
GNU General Public License v3.0
23.07k stars 7.99k forks source link

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

Open LY06-10 opened 2 months ago

LY06-10 commented 2 months ago

博主大大你好,我在使用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 commented 1 day ago

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