Skip to content
Snippets Groups Projects

Resolve "No need to have macOS builds" + updated documentation

Closed Guillaume HEUSCH requested to merge 1-no-need-to-have-macos-builds into master
1 file
+ 6
15
Compare changes
  • Side-by-side
  • Inline
import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import make_conv_layers
CASIA_CONFIG = [32, 64, 'M', 64, 128, 'M', 96, 192, 'M', 128, 256, 'M', 160, 320]
class CASIANet(nn.Module):
class CASIANet(torch.nn.Module):
""" The class defining the CASIA-Net CNN model.
This class implements the CNN described here:
@Misc{yi-arxiv-2014,
Author = {Yi, D. and Lei, Z. and Liao, S. and Li, S.Z.},
Title = {Learning {F}ace {R}epresentation {F}rom {S}cratch},
eprint = {arXiv:1411.7923},
year = 2014
}
This class implements the CNN described in:
"Learning Face Representation From Scratch", D. Yi, Z. Lei, S. Liao and S.z. Li, 2014
Attributes
----------
@@ -49,8 +40,8 @@ class CASIANet(nn.Module):
self.num_classes = num_cls
self.drop_rate = float(drop_rate)
self.conv = make_conv_layers(CASIA_CONFIG)
self.avgpool = nn.AvgPool2d(8)
self.classifier = nn.Linear(320, self.num_classes)
self.avgpool = torch.nn.AvgPool2d(8)
self.classifier = torch.nn.Linear(320, self.num_classes)
def forward(self, x):
""" Propagate data through the network
@@ -70,6 +61,6 @@ class CASIANet(nn.Module):
x = self.conv(x)
x = self.avgpool(x)
x = x.view(x.size(0), -1)
x = F.dropout(x, p = self.drop_rate, training=self.training)
x = torch.nn.functional.dropout(x, p = self.drop_rate, training=self.training)
out = self.classifier(x)
return out, x # x for feature
Loading