facebookresearch / Mask2Former

Code release for "Masked-attention Mask Transformer for Universal Image Segmentation"
MIT License
2.59k stars 388 forks source link

Error while evaluating instance segmentation training #198

Open omerfguzel opened 1 year ago

omerfguzel commented 1 year ago

Hi, I'm trying to train instance segmentation model with custom dataset and R-101 model weights. While training, i get following error sometimes in evaluation phase:

Traceback (most recent call last): File "train_net2.py", line 389, in args=(args,), File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/launch.py", line 82, in launch main_func(*args) File "train_net2.py", line 377, in main return trainer.train() File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 484, in train super().train(self.start_iter, self.max_iter) File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 150, in train self.after_step() File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/train_loop.py", line 180, in after_step h.after_step() File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/hooks.py", line 553, in after_step self._do_eval() File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/hooks.py", line 526, in _do_eval results = self._func() File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 453, in test_and_save_results self._last_eval_results = self.test(self.cfg, self.model) File "/opt/conda/lib/python3.7/site-packages/detectron2/engine/defaults.py", line 608, in test results_i = inference_on_dataset(model, data_loader, evaluator) File "/opt/conda/lib/python3.7/site-packages/detectron2/evaluation/evaluator.py", line 204, in inference_on_dataset results = evaluator.evaluate() File "/opt/conda/lib/python3.7/site-packages/detectron2/evaluation/coco_evaluation.py", line 194, in evaluate self._eval_predictions(predictions, img_ids=img_ids) File "/opt/conda/lib/python3.7/site-packages/detectron2/evaluation/coco_evaluation.py", line 229, in _eval_predictions f"A prediction has class={category_id}, " AssertionError: A prediction has class=6, but the dataset only has 6 classes and predicted class id should be in [0, 5].

I use a docker container to run mask2former. I can supply any other relevant information if you need. Any idea about the reason?