| 410 | |
| 411 | class FanEncoder(ModelMixin, ConfigMixin, FromOriginalModelMixin): |
| 412 | def __init__(self, pose_dim=6, eye_dim=6): |
| 413 | super(FanEncoder, self).__init__() |
| 414 | self.model = FAN_use() |
| 415 | |
| 416 | self.to_mouth = nn.Sequential( |
| 417 | nn.Linear(512, 512), nn.ReLU(), nn.BatchNorm1d(512), nn.Linear(512, 512) |
| 418 | ) |
| 419 | self.mouth_embed = nn.Sequential( |
| 420 | nn.ReLU(), nn.Linear(512, 512 - pose_dim - eye_dim) |
| 421 | ) |
| 422 | |
| 423 | self.to_headpose = nn.Sequential( |
| 424 | nn.Linear(512, 512), nn.ReLU(), nn.BatchNorm1d(512), nn.Linear(512, 512) |
| 425 | ) |
| 426 | self.headpose_embed = nn.Sequential(nn.ReLU(), nn.Linear(512, pose_dim)) |
| 427 | |
| 428 | self.to_eye = nn.Sequential( |
| 429 | nn.Linear(512, 512), nn.ReLU(), nn.BatchNorm1d(512), nn.Linear(512, 512) |
| 430 | ) |
| 431 | self.eye_embed = nn.Sequential(nn.ReLU(), nn.Linear(512, eye_dim)) |
| 432 | |
| 433 | self.to_emo = nn.Sequential( |
| 434 | nn.Linear(512, 512), nn.ReLU(), nn.BatchNorm1d(512), nn.Linear(512, 512) |
| 435 | ) |
| 436 | self.emo_embed = nn.Sequential(nn.ReLU(), nn.Linear(512, 30)) |
| 437 | |
| 438 | def forward_feature(self, x): |
| 439 | net = self.model(x) |