def forward(self, query_points, support_points, neighbors_indices, features): """ This module performs a Kernel Point Convolution. (both normal and strided version) :param query_points: float32[n_points, dim] - input query points (center of neighborhoods) :param support_points: float32[n0_points, dim] - input support points (from which neighbors are taken) :param neighbors_indices: int32[n_points, n_neighbors] - indices of neighbors of each point :param features: float32[n_points, in_fdim] - input features :return: output_features float32[n_points, out_fdim] """ if self.deformable_v2: x = conv_ops.KPConv_deformable_v2( query_points, support_points, neighbors_indices, features, K_values=self.weight, w0=self.offset_weight, b0=self.offset_bias, fixed=self.config.fixed_kernel_points, KP_extent=self.config.KP_extent * self.radius / self.config.density_parameter, KP_influence=self.config.KP_influence, aggregation_mode=self.config.convolution_mode, modulated=self.config.modulated) else: x = conv_ops.KPConv_deformable( query_points, support_points, neighbors_indices, features, K_values=self.weight, w0=self.offset_weight, b0=self.offset_bias, fixed=self.config.fixed_kernel_points, KP_extent=self.config.KP_extent * self.radius / self.config.density_parameter, KP_influence=self.config.KP_influence, aggregation_mode=self.config.convolution_mode, modulated=self.config.modulated) if self.config.use_batch_norm: x = self.relu(self.bn(x)) else: x = self.relu(x) return x
def KPConv_deformable_v2(query_points, support_points, neighbors_indices, features, K_values, radius, config): """ Perform a simple convolution followed by a batch normalization (or a simple bias) and ReLu """ # Get KP extent from current radius and config density extent = config.KP_extent * radius / config.density_parameter # Convolution return conv_ops.KPConv_deformable_v2(query_points, support_points, neighbors_indices, features, K_values, config.num_kernel_points, fixed=config.fixed_kernel_points, KP_extent=extent, KP_influence=config.KP_influence, mode=config.convolution_mode, modulated=config.modulated)