| 146 | |
| 147 | |
| 148 | class FaceNet64(nn.Module): |
| 149 | def __init__(self, num_classes=1000): |
| 150 | super(FaceNet64, self).__init__() |
| 151 | self.feature = evolve.IR_50_64((64, 64)) |
| 152 | self.feat_dim = 512 |
| 153 | self.num_classes = num_classes |
| 154 | self.output_layer = nn.Sequential(nn.BatchNorm2d(512), |
| 155 | nn.Dropout(), |
| 156 | Flatten(), |
| 157 | nn.Linear(512 * 4 * 4, 512), |
| 158 | nn.BatchNorm1d(512)) |
| 159 | |
| 160 | self.fc_layer = nn.Linear(self.feat_dim, self.num_classes) |
| 161 | |
| 162 | def forward(self, x): |
| 163 | feat = self.feature(x) |
| 164 | feat = self.output_layer(feat) |
| 165 | feat = feat.view(feat.size(0), -1) |
| 166 | out = self.fc_layer(feat) |
| 167 | __, iden = torch.max(out, dim=1) |
| 168 | iden = iden.view(-1, 1) |
| 169 | return feat, out |
| 170 | |
| 171 | |
| 172 | class IR152(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected