PET icon indicating copy to clipboard operation
PET copied to clipboard

关于训练和推理的区别以及推理人数的问题

Open UntrainedButLoveCode opened this issue 1 year ago • 2 comments

你好!Liu Chengxin,非常喜欢你这篇文章。有两个问题想请教一下你。

1.训练的时候,在split_map_dense和split_map_sparse上都计算出全部查询点;而推理的时候,则是根据split_map中的概率得到稀疏/密集区域的有效区域,只在有效区域内计算出查询点,注意力的计算都集中在这些区域内。我的理解应该没错吧?我看到之前有人也提出这个问题。

2.推理的时候,人数和点坐标是如何得到的?dense和sparsel两部分得到的查询点结果,直接合并在一起吗?如果一个人被计算了两次,直接合并是不是会造成预测偏多?我对这部分不太理解,希望你能解答一下,非常感谢。

# format output
        div_out = dict()
        output_names = out_sparse.keys() if out_sparse is not None else out_dense.keys()
        for name in list(output_names):
            if 'pred' in name:
                if index_dense is None:
                    div_out[name] = out_sparse[name][index_sparse].unsqueeze(0)
                elif index_sparse is None:
                    div_out[name] = out_dense[name][index_dense].unsqueeze(0)
                else:
                    div_out[name] = torch.cat([out_sparse[name][index_sparse].unsqueeze(0), out_dense[name][index_dense].unsqueeze(0)], dim=1)
            else:
                div_out[name] = out_sparse[name] if out_sparse is not None else out_dense[name]
        div_out['split_map_raw'] = outputs['split_map_raw']

UntrainedButLoveCode avatar Oct 05 '24 17:10 UntrainedButLoveCode

Thanks for your interest in our work. Here are the answers to your questions:

  1. Your understanding is correct.
  2. We use split map to estimate sparse and dense regions. Dense point queries (out_dense) are only responsible for object prediction in dense regions. Similarly, sparse point queries (out_sparse) only predict objects in sparse regions. The code you mentioned merges the predictions from sparse and dense regions. In this case, an object will be counted once.
  3. Regarding object prediction, please refer to pet.py L131.

cxliu0 avatar Oct 06 '24 01:10 cxliu0

Thanks for your interest in our work. Here are the answers to your questions:

  1. Your understanding is correct.
  2. We use split map to estimate sparse and dense regions. Dense point queries (out_dense) are only responsible for object prediction in dense regions. Similarly, sparse point queries (out_sparse) only predict objects in sparse regions. The code you mentioned merges the predictions from sparse and dense regions. In this case, an object will be counted once.
  3. Regarding object prediction, please refer to pet.py L131.

Really appreciate!!!

UntrainedButLoveCode avatar Oct 06 '24 05:10 UntrainedButLoveCode