Skip to content

KeyError: 1, when using only 1 class dataset to evaluation #106

@YipChakwai

Description

@YipChakwai

When I use my own dataset(only 1 class) to evaluation, I got the following error. I'd appreciate it if you could guide me.

Traceback (most recent call last):
File "G:/SparseR-CNN-main/projects/SparseRCNN/train_net.py", line 176, in
launch(
File "G:\SparseR-CNN-main\detectron2\engine\launch.py", line 66, in launch
main_func(*args)
File "G:/Code+paper/SparseR-CNN-main/projects/SparseRCNN/train_net.py", line 170, in main
return trainer.train()
File "G:\SparseR-CNN-main\detectron2\engine\defaults.py", line 421, in train
super().train(self.start_iter, self.max_iter)
File "G:\SparseR-CNN-main\detectron2\engine\train_loop.py", line 144, in train
self.after_train()
File "G:\SparseR-CNN-main\detectron2\engine\train_loop.py", line 153, in after_train
h.after_train()
File "G:\SparseR-CNN-main\detectron2\engine\hooks.py", line 361, in after_train
self._do_eval()
File "G:\SparseR-CNN-main\detectron2\engine\hooks.py", line 331, in _do_eval
results = self._func()
File "G:\SparseR-CNN-main\detectron2\engine\defaults.py", line 374, in test_and_save_results
self._last_eval_results = self.test(self.cfg, self.model)
File "G:\SparseR-CNN-main\detectron2\engine\defaults.py", line 542, in test
results_i = inference_on_dataset(model, data_loader, evaluator)
File "G:\SparseR-CNN-main\detectron2\evaluation\evaluator.py", line 176, in inference_on_dataset
results = evaluator.evaluate()
File "G:\SparseR-CNN-main\detectron2\evaluation\coco_evaluation.py", line 173, in evaluate
self._eval_predictions(predictions, img_ids=img_ids)
File "G:\SparseR-CNN-main\detectron2\evaluation\coco_evaluation.py", line 212, in _eval_predictions
result["category_id"] = reverse_id_mapping[category_id]
KeyError: 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @YipChakwai

        Issue actions

          KeyError: 1, when using only 1 class dataset to evaluation · Issue #106 · PeizeSun/SparseR-CNN