(self, num_classes, embed_dim, use_att, dropout=0.1,
extra_feature_channels=3, width_multiplier=1, voxel_resolution_multiplier=1)
| 172 | class PVCNN2Base(nn.Module): |
| 173 | |
| 174 | def __init__(self, num_classes, embed_dim, use_att, dropout=0.1, |
| 175 | extra_feature_channels=3, width_multiplier=1, voxel_resolution_multiplier=1): |
| 176 | super().__init__() |
| 177 | assert extra_feature_channels >= 0 |
| 178 | self.embed_dim = embed_dim |
| 179 | self.in_channels = extra_feature_channels + 3 |
| 180 | |
| 181 | sa_layers, sa_in_channels, channels_sa_features, _ = create_pointnet2_sa_components( |
| 182 | sa_blocks=self.sa_blocks, extra_feature_channels=extra_feature_channels, with_se=True, embed_dim=embed_dim, |
| 183 | use_att=use_att, dropout=dropout, |
| 184 | width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier |
| 185 | ) |
| 186 | self.sa_layers = nn.ModuleList(sa_layers) |
| 187 | |
| 188 | self.global_att = None if not use_att else Attention(channels_sa_features, 8, D=1) |
| 189 | |
| 190 | # only use extra features in the last fp module |
| 191 | sa_in_channels[0] = extra_feature_channels |
| 192 | fp_layers, channels_fp_features = create_pointnet2_fp_modules( |
| 193 | fp_blocks=self.fp_blocks, in_channels=channels_sa_features, sa_in_channels=sa_in_channels, with_se=True, embed_dim=embed_dim, |
| 194 | use_att=use_att, dropout=dropout, |
| 195 | width_multiplier=width_multiplier, voxel_resolution_multiplier=voxel_resolution_multiplier |
| 196 | ) |
| 197 | self.fp_layers = nn.ModuleList(fp_layers) |
| 198 | |
| 199 | |
| 200 | layers, _ = create_mlp_components(in_channels=channels_fp_features, out_channels=[128, dropout, num_classes], # was 0.5 |
| 201 | classifier=True, dim=2, width_multiplier=width_multiplier) |
| 202 | self.classifier = nn.Sequential(*layers) |
| 203 | |
| 204 | self.embedf = nn.Sequential( |
| 205 | nn.Linear(embed_dim, embed_dim), |
| 206 | nn.LeakyReLU(0.1, inplace=True), |
| 207 | nn.Linear(embed_dim, embed_dim), |
| 208 | ) |
| 209 | |
| 210 | def get_timestep_embedding(self, timesteps, device): |
| 211 | assert len(timesteps.shape) == 1 # and timesteps.dtype == tf.int32 |
nothing calls this directly
no test coverage detected