X-Decoder icon indicating copy to clipboard operation
X-Decoder copied to clipboard

The shape mismatch in evaluation

Open WenlongZhang0517 opened this issue 1 year ago • 1 comments

**I encountered a simple bug when evaluating. How can this problem be solved? It seems like 817920 is three times as much as 272540. **


/home/user/anaconda3/envs/xdecoder/lib/python3.9/site-packages/detectron2/structures/image_list.py:88: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  max_size = (max_size + (stride - 1)) // stride * stride
/nvme/user/project/X-Decoder/xdecoder/modules/position_encoding.py:41: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
/nvme/user/project/X-Decoder/xdecoder/architectures/xdecoder_model.py:899: UserWarning: __floordiv__ is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
  topk_indices = (topk_indices // self.sem_seg_head.num_classes)
Traceback (most recent call last):
  File "/nvme/user/project/X-Decoder/entry.py", line 53, in <module>
    main()
  File "/nvme/user/project/X-Decoder/entry.py", line 48, in main
    trainer.eval()
  File "/nvme/user/project/X-Decoder/trainer/default_trainer.py", line 82, in eval
    results = self._eval_on_set(self.save_folder)
  File "/nvme/user/project/X-Decoder/trainer/default_trainer.py", line 87, in _eval_on_set
    results = self.pipeline.evaluate_model(self, save_folder)
  File "/nvme/user/project/X-Decoder/./pipeline/XDecoderPipeline.py", line 162, in evaluate_model
    self.evaluator.process(batch, outputs)
  File "/home/user/anaconda3/envs/xdecoder/lib/python3.9/site-packages/detectron2/evaluation/evaluator.py", line 88, in process
    evaluator.process(inputs, outputs)
  File "/nvme/user/project/X-Decoder/datasets/evaluation/segmentation_evaluation.py", line 113, in process
    (self._num_classes + 4) * pred.reshape(-1) + gt.reshape(-1),
ValueError: operands could not be broadcast together with shapes (272640,) (817920,) 

WenlongZhang0517 avatar Aug 14 '23 11:08 WenlongZhang0517

Interesting, I have never met with this bug before. Have you ever change any code, including batchsize/image size and etc.?

MaureenZOU avatar Sep 25 '23 01:09 MaureenZOU