Point-GNN

1.os.path.join 路径要写完全了

1
2
3
4
DATASET_DIR="/dataset/KITTI"
DATASET_SPLIT_FILE = os.path.join(DATASET_DIR,'3DOP_splits/'+train_config['train_dataset'])
print(DATASET_SPLIT_FILE)
/dataset/KITTI/3DOP_splits/train_car.txt

2.数据增强tips: * * kwargs和 * args :

可以设置选择data augment的模式:如下就是选择random_rotation_all模式对应的操作。

  • args传的是【非键值对】可变数量的参数*列表 *

      • kwargs 传递的就是具体方法涉及的参数信息不定长度【键值对】。
1
2
3
aug_method = aug_method_map[aug_config['method_name']]
cam_rgb_points, labels = aug_method(
cam_rgb_points, labels, **aug_config['method_kwargs'])
  • 测试
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"data_aug_configs": [
{
"method_kwargs": {
"expend_factor": [
1.0,
1.0,
1.0
],
"method_name": "normal",
"yaw_std": 0.39269908169872414
},
"method_name": "random_rotation_all"
},
...]
aug_method_map = {
'random_jitter': random_jitter,
'random_box_rotation': random_box_rotation,
'random_box_shift': random_box_shift,
'random_transition': random_transition,
'remove_background': remove_background,
'random_rotation_all': random_rotation_all,
'random_flip_all': random_flip_all,...}

def random_rotation_all(cam_rgb_points, labels, method_name='normal',
yaw_std=0.3, expend_factor=(1.0, 1.1, 1.1)):
xyz = cam_rgb_points.xyz
if method_name == 'normal':
delta_yaw = np.random.normal(scale=yaw_std)
else:
if method_name == 'uniform':
...

3.Points = namedtuple(‘Points’, [‘xyz’, ‘attr’])

velo points[x,y,z,flection] velopoints2camera points xyz in camera with rgb[x,y,z,flection,RGB]

4.建图

1
2
3
4
graph_generate_fn= get_graph_generate_fn(config['graph_gen_method'])

(vertex_coord_list, keypoint_indices_list, edges_list) = \
graph_generate_fn(cam_rgb_points.xyz, **config['graph_gen_kwargs'])

gen_multi_level_local_graph_v3

voxel采样:multi_layer_downsampling

采样后 得到vertex+keypoint_indices 相当于node

create edges 重要参数 graph_level

  • 自己采样测试 :结果1024→816;1000→802

遍历采样后的每一个点,找邻居值【使用kneighbors】

5.数据变化过程:以car为例 input:3260samples

分成两个batch [m,n]【猜测是并行加载数据的操作,看不懂为啥这边要分两个】

batch_list += [fetch_data(dataset, m或n, train_config, config)]

input_v, vertex_coord_list, keypoint_indices_list, edges_list, \

​ cls_labels, encoded_boxes, valid_boxes = batch_data(batch_list)

cam_rgb_points:[x,y,z,flection,RGB]

input_v = cam_rgb_points.attr.flection

假设graph level=2

points_xyz = vertex_coord_list[0]

keypoint_indices_list=特征点的index

  • 结果分析:

共有37255个point 【含有xyz坐标:vertex_coord_list[0] 】下采样得到3091个点【含有xyz坐标:points_xyz = vertex_coord_list[1]】

下采样的点在原始point中的index:keypoint_indices_list: 3,6,19…

vertex_coord_list [ 0 ] [ 3 ]==→ vertex_coord_list[ 1 ] [ 0 ]

【torch.equal(vertex_coord_list[1],vertex_coord_list[2]) =True 为什么是一样的】

valid_boxes:flag :bool 表明采样后的 points 在一个 3D box中 比如sum(valid_boxes)=145,有145个点在框中,当然是越大越好。