microsoft / RepPoints

Represent Visual Objects by Point Sets
MIT License
588 stars 75 forks source link

Dimension difference between proposal and gt_bboxes #17

Open muditchaudhary opened 4 years ago

muditchaudhary commented 4 years ago

I am trying to use Random Sampler and Cross Entropy Loss. But I am receiving a runtime error for sampling the points.

/research/byu2/mudit7/FYP/RepPoints/mmdetection/mmdet/core/bbox/assign_sampling.py in assign_and_sample(bboxes, gt_bboxes, gt_bboxes_ignore, gt_labels, cfg)
     30                                          gt_labels)
     31     sampling_result = bbox_sampler.sample(assign_result, bboxes, gt_bboxes,
---> 32                                           gt_labels)
     33     return assign_result, sampling_result

/research/byu2/mudit7/FYP/RepPoints/mmdetection/mmdet/core/bbox/samplers/base_sampler.py in sample(self, assign_result, bboxes, gt_bboxes, gt_labels, **kwargs)
     53         gt_flags = bboxes.new_zeros((bboxes.shape[0], ), dtype=torch.uint8)
     54         if self.add_gt_as_proposals:
---> 55             bboxes = torch.cat([gt_bboxes, bboxes], dim=0)
     56             assign_result.add_gt_(gt_labels)
     57             gt_ones = bboxes.new_ones(gt_bboxes.shape[0], dtype=torch.uint8)

RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 3 and 4 in dimension 1 at /opt/conda/conda-bld/pytorch_1556653114079/work/aten/src/THC/generic/THCTensorMath.cu:71

I tried to check the dimension size of the proposal and gt_bboxes.

proposals.size()
In [1]: Out[1]: torch.Size([21875, 3])

In [1]: Out[1]: torch.Size([19197, 3])

gt_bboxes.size()
In [2]: Out[2]: torch.Size([19, 4])
In [2]: Out[2]: torch.Size([16, 4])

Why is there a difference in dimension?

muditchaudhary commented 4 years ago

Moreover, I need to check what do these proposals represent

proposals[1]
In [3]: Out[3]: tensor([8., 0., 8.], device='cuda:0')

In [3]: Out[3]: tensor([8., 0., 8.], device='cuda:1')

proposals[3]
In [4]: Out[4]: tensor([24.,  0.,  8.], device='cuda:1')

In [4]: Out[4]: tensor([24.,  0.,  8.], device='cuda:0')

gt_bboxes[1]
In [5]: Out[5]: tensor([304.9307, 240.0716, 700.5638, 717.9418], device='cuda:1')

In [5]: Out[5]: tensor([217.8107,   1.8210, 288.8287, 123.9898], device='cuda:0')

It seems like it does not represent bbox.