Megvii-BaseDetection / BEVDepth

Official code for BEVDepth.
MIT License
730 stars 101 forks source link

Some questions about code matrixvt.py #152

Open wuwangzhuanwan opened 1 year ago

wuwangzhuanwan commented 1 year ago

On line 280 and 282 of bevdepth/layers/backbones/matrixvt.py, ray_map[b, dir, geom_idx[b, dir]] += 1 and circle_map[b, d, geom_idx[b, :, d]] += 1 , they are equivalent ray_map[b, dir, geom_idx[b, dir]] = 1 and circle_map[b, d, geom_idx[b, :, d]] = 1,right?I don't think it's necessary to add a plus sign

ZRandomize commented 1 year ago

This is a incremental imrpovement that brought about 0.2 mAP, we found that a soft maxtrix is a little bit better than a binary one.

ZhouZijie77 commented 1 year ago

Hello, I have the same confusion. I found they are equivalent. Have you ever checked the result of ray_map[b, dir, geom_idx[b, dir]] += 1 and circle_map[b, d, geom_idx[b, :, d]] += 1?

ZRandomize commented 1 year ago

They are not equivalent since geom_idx may contains serveral same indexes

ZhouZijie77 commented 1 year ago

Thank you for your reply! But I still have some questions. I found that the maximum values of ray_map and circle_map are 1. Then I did a simple test:

a = torch.tensor([0, 1, 1, 3, 3, 3], dtype=torch.long)
b = torch.zeros(5)
b[a]+=1
print(b)

The result is tensor([1., 1., 0., 1., 0.]) instead of tensor([1., 2., 0., 3., 0.])

ZRandomize commented 1 year ago

Well, this is not expected for me. In that case, the observed improvement might be only fluatuation. But this proved that a binary matrix will work well as stated in the paper :)

ZhouZijie77 commented 1 year ago

Thank you