Download lib/models/decoder/decoder_ground.py from dqj5182/FECO: direct link, hf CLI and curl.
- Browser
- Download file 510 Bytes
-
https://huggingface.co/spaces/dqj5182/FECO/resolve/main/lib/models/decoder/decoder_ground.py
- Command line
-
hf download hf://spaces/dqj5182/FECO/lib/models/decoder/decoder_ground.py
-
curl -L -o decoder_ground.py https://huggingface.co/spaces/dqj5182/FECO/resolve/main/lib/models/decoder/decoder_ground.py
510 Bytes
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class GroundNormalHead(nn.Module): | |
| def __init__(self, in_channels): | |
| super().__init__() | |
| self.pool = nn.AdaptiveAvgPool2d(1) | |
| self.head = nn.Sequential( | |
| nn.Linear(in_channels, 128), | |
| nn.ReLU(), | |
| nn.Linear(128, 3), | |
| nn.Tanh() | |
| ) | |
| def forward(self, x): | |
| x = self.pool(x).view(x.size(0), -1) | |
| x = self.head(x) | |
| x = F.normalize(x, dim=-1) | |
| return x | |