Beispiel #1
0
 def build_optimizer(self):
     """
     Create optimizer
     """
     self.optimizer = optim.Adam(self.network.parameters(), lr=self.opt.lrate)
     if self.opt.reload:
         self.optimizer.load_state_dict(torch.load(f'{self.opt.checkpointname}'))
         my_utils.yellow_print("Reloaded optimizer")
Beispiel #2
0
    def __init__(self,
                 num_points=6890,
                 encoder_type="Pointnet",
                 bottleneck_size=1024,
                 nb_primitives=1,
                 hidden_sizes=[64, 64, 64, 64, 64],
                 resnet_layers=True,
                 skip_connections=False):
        self.hidden_sizes = hidden_sizes
        self.resnet_layers = resnet_layers
        super(AE_Meta_AtlasNet, self).__init__()
        self.num_points = num_points
        self.bottleneck_size = bottleneck_size
        self.nb_primitives = nb_primitives
        self.encoder_type = encoder_type
        print("Using encoder type : " + self.encoder_type)

        self.point_encoder_1 = PointNetfeat(num_points,
                                            global_feat=True,
                                            trans=False)
        self.point_encoder_2 = PointNetfeat(num_points,
                                            global_feat=True,
                                            trans=False)
        self.encoder = nn.Sequential(self.point_encoder_1,
                                     nn.Linear(1024, 512), nn.BatchNorm1d(512),
                                     nn.ReLU())
        self.encoder2 = nn.Sequential(self.point_encoder_2,
                                      nn.Linear(1024,
                                                512), nn.BatchNorm1d(512),
                                      nn.ReLU())

        self.decoder = MetaPointGenCon2(bottleneck_size=self.bottleneck_size,
                                        hidden_sizes=hidden_sizes,
                                        resnet_layers=resnet_layers)
        self.skip_connections = skip_connections
        if self.skip_connections:
            my_utils.yellow_print("Enable Skip_connections in pointcloud MLP")
            self.forward = self.forward_resnet
        else:
            my_utils.yellow_print("Desable Skip_connections in pointcloud MLP")
            self.forward = self.forward_classic