FECO / lib /models /decoder /decoder_ground.py
dqj5182's picture
Build ViT-H FECO Space with HMR2 foot crops
41ad279
Raw History Blame Contribute Delete
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