Skip to content

Question of code version in geomtransformer module #1

Description

@name555difficult

Error information 1

experiments/mode.py#171

code:

        ref_node_corr_indices, src_node_corr_indices, node_corr_scores = self.coarse_matching(
            ref_feats_c_norm, src_feats_c_norm, ref_node_masks, src_node_masks, mask
        )

error:

Traceback (most recent call last):
  File "trainval.py", line 66, in <module>
    main()
  File "trainval.py", line 62, in main
    trainer.run()
  File "/data16t/xxx/HybridReg_PyTorch/geotransformer/engine/epoch_based_trainer.py", line 180, in run
    self.train_epoch()
  File "/data16t/xxx/HybridReg_PyTorch/geotransformer/engine/epoch_based_trainer.py", line 95, in train_epoch
    output_dict, result_dict = self.train_step(self.epoch, self.inner_iteration, data_dict)
  File "trainval.py", line 43, in train_step
    output_dict = self.model(data_dict)
  File "/data/xxx/miniconda3/envs/hybridreg/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/data16t/xxx/HybridReg_PyTorch/experiments/hybridmatch/model.py", line 176, in forward
    ref_node_corr_indices, src_node_corr_indices, node_corr_scores = self.coarse_matching(
  File "/data/xxx/miniconda3/envs/hybridreg/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
TypeError: forward() takes from 3 to 5 positional arguments but 6 were given

The mask parameter is redundant in the SuperPointMatching module. The parameters of 'SuperPointMatching.forward()' are:

class SuperPointMatching(nn.Module):
    def __init__(self, num_correspondences, dual_normalization=True):
        super(SuperPointMatching, self).__init__()
        self.num_correspondences = num_correspondences
        self.dual_normalization = dual_normalization

    def forward(self, ref_feats, src_feats, ref_masks=None, src_masks=None):
        r"""Extract superpoint correspondences.

        Args:
            ref_feats (Tensor): features of the superpoints in reference point cloud.
            src_feats (Tensor): features of the superpoints in source point cloud.
            ref_masks (BoolTensor=None): masks of the superpoints in reference point cloud (False if empty).
            src_masks (BoolTensor=None): masks of the superpoints in source point cloud (False if empty).

        Returns:
            ref_corr_indices (LongTensor): indices of the corresponding superpoints in reference point cloud.
            src_corr_indices (LongTensor): indices of the corresponding superpoints in source point cloud.
            corr_scores (Tensor): scores of the correspondences.
        """
        if ref_masks is None:
            ref_masks = torch.ones(size=(ref_feats.shape[0],), dtype=torch.bool).cuda()
        if src_masks is None:
            src_masks = torch.ones(size=(src_feats.shape[0],), dtype=torch.bool).cuda()
...

Error information 2

experiments/hybridmatch/loss.py#92

code:

aplace_loss, corr_loss, mask_loss = self.laplace_loss(output_dict, data_dict)

The returned variables self.laplace_loss(LaplaceLoss) are

...
        if self.stage == 1:
            corr_sp_mask = torch.ones(corr_gt.shape[0] + corr_gt.shape[1], device=device)
        else:
            corr_sp_mask = output_dict['corr_sp_mask']
        loss = self.loss(corr_gt, corr_es, (1 - corr_sp_mask))
        return loss, 1-gt_mask

The variables are not matched between the defined version and the captured version.

summary

Maybe the version of geotransformer module is not matched with the code in hybridmatch experiment.

Sincere thanks to the author for reading and answering my questions in time, and correcting possible errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions