| 14 | |
| 15 | |
| 16 | class VGG(nn.Module): |
| 17 | def __init__(self, features): |
| 18 | super(VGG, self).__init__() |
| 19 | self.features = features |
| 20 | self.embeddings = nn.Sequential( |
| 21 | nn.Linear(512 * 4 * 6, 4096), |
| 22 | nn.ReLU(True), |
| 23 | nn.Linear(4096, 4096), |
| 24 | nn.ReLU(True), |
| 25 | nn.Linear(4096, 128), |
| 26 | nn.ReLU(True)) |
| 27 | |
| 28 | def forward(self, x): |
| 29 | x = self.features(x) |
| 30 | |
| 31 | # Transpose the output from features to |
| 32 | # remain compatible with vggish embeddings |
| 33 | x = torch.transpose(x, 1, 3) |
| 34 | x = torch.transpose(x, 1, 2) |
| 35 | x = x.contiguous() |
| 36 | x = x.view(x.size(0), -1) |
| 37 | |
| 38 | return x |
| 39 | # return self.embeddings(x) |
| 40 | |
| 41 | |
| 42 | class Postprocessor(nn.Module): |