NormXU/Layout2Graph

Graph sampling

yudezhi123456 opened this issue · 2 comments

Excellent work! I was wondering if the graph sampling part mentioned in the paper was the part pointed to by my link below. I did not find the graph sampling technique related to the paper in the code, thank you for your answer.

pair_cell_list.append(list(itertools.combinations(range(0, box_num), r=2)))

NormXU commented

@yudezhi123456 The graph sampling code is here:

def _get_nearest_pair(self, graphs, cell_boxes):
pair_cell_list = []
for index in range(len(graphs)):
# TODO GCN graph KNNGraph 跑不通
if graphs[index].num_nodes == 1 and self.graph.graph_type == 'GCN':
edge_index_list = []
elif self.sampling_strategy == 'KNN':
edge_index_list = _get_nearest_pair_knn(cell_boxes[index], self.k_nearest_num)
elif self.sampling_strategy == 'BetaSkeleton':
edge_index_list = _get_nearest_pair_beta_skeleton(cell_boxes[index])
else:
cell_boxes_array = cell_boxes[index].cpu().numpy()
edge_index_list = _get_nearest_pair_custom(cell_boxes_array, self.rope_max_length)
pair_cell_list.append(edge_index_list)
return pair_cell_list

We provide three ways to sample the graph: KNN, Beta-skeleton, and customized which is mainly based on prior knowledge and geometry information of bounding boxes.

Thank you for your prompt answer!