MCPcopy Create free account
hub / github.com/TEA-Lab/TwoByTwo / VN_DGCNN_New

Class VN_DGCNN_New

src/shape_assembly/models/encoder/vn_dgcnn.py:171–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169 return x, x1 # [batch, 1024, 3], [batch, 1024, 1024]
170
171class VN_DGCNN_New(nn.Module):
172
173 def __init__(self, feat_dim):
174 super(VN_DGCNN_New, self).__init__()
175 self.n_knn = 20
176 num_part = feat_dim
177
178 print("feat_dim is: ", feat_dim)
179
180 pooling = 'mean'
181
182 self.conv1 = VNLinearLeakyReLU(2, 64 // 3)
183 self.conv2 = VNLinearLeakyReLU(64 // 3, 64 // 3)
184 self.conv3 = VNLinearLeakyReLU(64 // 3 * 2, 64 // 3)
185 self.conv4 = VNLinearLeakyReLU(64 // 3, 64 // 3)
186 self.conv5 = VNLinearLeakyReLU(64 // 3 * 2, 64 // 3)
187 self.VnInv = VNStdFeature(2 * feat_dim, dim=3, normalize_frame=False)
188
189 if pooling == 'max':
190 self.pool1 = VNMaxPool(64 // 3)
191 self.pool2 = VNMaxPool(64 // 3)
192 self.pool3 = VNMaxPool(64 // 3)
193 self.pool4 = VNMaxPool(2 * feat_dim)
194 elif pooling == 'mean':
195 self.pool1 = mean_pool
196 self.pool2 = mean_pool
197 self.pool3 = mean_pool
198 self.pool4 = mean_pool
199
200 self.conv6 = VNLinearLeakyReLU(64 // 3 * 3, feat_dim, dim=4, share_nonlinearity=True)
201 self.linear0 = nn.Linear(3, 2 * feat_dim)
202
203 def forward(self, x):
204
205 batch_size = x.size(0)
206 num_points = x.size(2)
207 l = x[:, 0, 0:16].reshape(batch_size, 1, 16)
208
209 x = x.unsqueeze(1) # (32, 1, 3, 1024)
210
211 x = get_graph_feature(x, k=self.n_knn) # (32, 2, 3, 1024, 20)
212
213 x = self.conv1(x) # (32, 21, 3, 1024, 20)
214 x = self.conv2(x) # (32, 21, 3, 1024, 20)
215 x1 = self.pool1(x) # (32, 21, 3, 1024)
216
217 x = get_graph_feature(x1, k=self.n_knn)
218 x = self.conv3(x)
219 x = self.conv4(x)
220 x2 = self.pool2(x)
221
222 x = get_graph_feature(x2, k=self.n_knn)
223 x = self.conv5(x)
224 x3 = self.pool3(x)
225
226 x123 = torch.cat((x1, x2, x3), dim=1)
227
228 x = self.conv6(x123)

Callers 3

init_encoderMethod · 0.90
init_encoderMethod · 0.90
init_encoderMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected