zju3dv / clean-pvnet

Code for "PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation" CVPR 2019 oral
Apache License 2.0
401 stars 106 forks source link

RuntimeError: masked_select: expected BoolTensor for mask in ransac_voting_gpu.py #277

Closed monajalal closed 11 months ago

monajalal commented 11 months ago
(clean-pvnet) mona@ada:~/clean-pvnet$ python run.py --type evaluate --cfg_file configs/linemod.yaml model cat cls_type cat
Load model: data/model/pvnet/cat/199.pth
loading annotations into memory...
Done (t=0.20s)
creating index...
index created!
loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
  0%|                                                                                                                                                                             | 0/1002 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/mona/clean-pvnet/run.py", line 276, in <module>
    globals()['run_'+args.type]()
  File "/home/mona/clean-pvnet/run.py", line 78, in run_evaluate
    output = network(inp)
  File "/home/mona/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/mona/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/mona/clean-pvnet/lib/networks/pvnet/resnet18.py", line 100, in forward
    self.decode_keypoint(ret)
  File "/home/mona/clean-pvnet/lib/networks/pvnet/resnet18.py", line 75, in decode_keypoint
    kpt_2d = ransac_voting_layer_v3(mask, vertex, 128, inlier_thresh=0.99, max_num=100)
  File "/home/mona/clean-pvnet/lib/csrc/ransac_voting/ransac_voting_gpu.py", line 144, in ransac_voting_layer_v3
    direct = vertex[bi].masked_select(torch.unsqueeze(torch.unsqueeze(cur_mask, 2), 3))  # [tn,vn,2]
RuntimeError: masked_select: expected BoolTensor for mask
monajalal commented 11 months ago

add this cur_mask = cur_mask.to(torch.bool) line 144:


        cur_mask = cur_mask.to(torch.bool) # mona
        direct = vertex[bi].masked_select(torch.unsqueeze(torch.unsqueeze(cur_mask, 2), 3))  # [tn,vn,2]
(clean-pvnet) mona@ada:~/clean-pvnet$ python run.py --type evaluate --cfg_file configs/linemod.yaml model cat cls_type cat
Load model: data/model/pvnet/cat/199.pth
loading annotations into memory...
Done (t=0.12s)
creating index...
index created!
loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1002/1002 [00:35<00:00, 28.38it/s]
2d projections metric: 0.0
ADD metric: 0.0
5 cm 5 degree metric: 0.0
mask ap70: 0.9960079840319361