Initialize DirectGaussianPredictor. Args: feature_dim: Number of input features. num_layers: The number of layers of Gaussians to predict.
(self, feature_dim: int, num_layers: int)
| 16 | """Decodes features into delta values using convolutions.""" |
| 17 | |
| 18 | def __init__(self, feature_dim: int, num_layers: int) -> None: |
| 19 | """Initialize DirectGaussianPredictor. |
| 20 | |
| 21 | Args: |
| 22 | feature_dim: Number of input features. |
| 23 | num_layers: The number of layers of Gaussians to predict. |
| 24 | """ |
| 25 | super().__init__() |
| 26 | self.num_layers = num_layers |
| 27 | |
| 28 | # 14 is 3 means, 3 scales, 4 quaternions, 3 colors and 1 opacity |
| 29 | self.geometry_prediction_head = nn.Conv2d(feature_dim, 3 * num_layers, 1) |
| 30 | self.geometry_prediction_head.weight.data.zero_() |
| 31 | assert self.geometry_prediction_head.bias is not None |
| 32 | self.geometry_prediction_head.bias.data.zero_() |
| 33 | |
| 34 | self.texture_prediction_head = nn.Conv2d(feature_dim, (14 - 3) * num_layers, 1) |
| 35 | self.texture_prediction_head.weight.data.zero_() |
| 36 | assert self.texture_prediction_head.bias is not None |
| 37 | self.texture_prediction_head.bias.data.zero_() |
| 38 | |
| 39 | def forward(self, image_features: ImageFeatures) -> torch.Tensor: |
| 40 | """Predict deltas for 3D Gaussians. |
nothing calls this directly
no outgoing calls
no test coverage detected