| 3 | import torch.nn.functional as F |
| 4 | |
| 5 | class PointNet(nn.Module): |
| 6 | def __init__(self, out_channels=(32, 64, 128), train_with_norm=True): |
| 7 | super(PointNet, self).__init__() |
| 8 | self.layers = nn.ModuleList() |
| 9 | in_channels = 3 |
| 10 | for out_channel in out_channels: |
| 11 | self.layers.append(nn.Conv1d(in_channels, out_channel, 1)) |
| 12 | self.layers.append(nn.BatchNorm1d(out_channel) if train_with_norm else nn.Identity()) |
| 13 | self.layers.append(nn.ReLU()) |
| 14 | in_channels = out_channel |
| 15 | self.global_pool = nn.AdaptiveMaxPool1d(1) |
| 16 | |
| 17 | def forward(self, x): |
| 18 | for layer in self.layers: |
| 19 | x = layer(x) |
| 20 | x = self.global_pool(x) |
| 21 | x = x.squeeze(-1) |
| 22 | return x |
| 23 | |
| 24 | class PoseClassifier(nn.Module): |
| 25 | def __init__(self, pointnet_out_dim=128, pose_dim=6, hidden_dims=(512, 256, 128)): |
no outgoing calls
no test coverage detected