MCPcopy Create free account
hub / github.com/NVIDIA/MinkowskiEngine / test_pcd

Method test_pcd

tests/cpp/convolution_cpu_test.py:86–131  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

84 )
85
86 def test_pcd(self):
87 IC, OC = 3, 16
88 coords, colors, pcd = load_file("1.ply")
89 kernel_size = [3, 3, 3]
90 kernel_stride = [2, 2, 2]
91 kernel_dilation = [1, 1, 1]
92
93 # size, in, out
94 kernel = torch.rand(27, IC, OC)
95
96 for batch_size in [1, 5, 10, 20, 40]:
97 for voxel_size in [0.05, 0.035, 0.02]:
98 min_time = 100000
99
100 dcoords = torch.from_numpy(np.floor(coords / voxel_size)).int()
101 bcoords = batched_coordinates([dcoords for i in range(batch_size)])
102
103 tcolors = torch.from_numpy(colors).float()
104 bcolors = torch.cat([tcolors for i in range(batch_size)])
105
106 for i in range(10):
107 manager = _C.CoordinateMapManager()
108
109 # batch insert
110 in_key, (unique_map, inverse_map) = manager.insert_and_map(
111 bcoords, [1, 1, 1], ""
112 )
113 ucolors = bcolors[unique_map.long()]
114 out_key = in_key
115
116 stime = time.time()
117 out_features = _C.ConvolutionForwardCPU(
118 ucolors,
119 kernel,
120 kernel_size,
121 kernel_stride,
122 kernel_dilation,
123 _C.RegionType.HYPER_CUBE,
124 torch.IntTensor(),
125 in_key,
126 out_key,
127 manager,
128 )
129 min_time = min(time.time() - stime, min_time)
130
131 print(f"{batch_size}\t{voxel_size}\t{manager.size(in_key)}\t{min_time}")
132
133 def test_pcd2(self):
134 IC, OC = 3, 16

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.95
load_fileFunction · 0.90
batched_coordinatesFunction · 0.90
floatMethod · 0.80
CoordinateMapManagerMethod · 0.80
insert_and_mapMethod · 0.45

Tested by

no test coverage detected