Esempio n. 1
0
 def __init__(self, w_in, w_out, num_classes):
     super(EffHead, self).__init__()
     dropout_ratio = cfg.EN.DROPOUT_RATIO
     self.conv = conv2d(w_in, w_out, 1)
     self.conv_bn = norm2d(w_out)
     self.conv_af = activation()
     self.avg_pool = gap2d(w_out)
     self.dropout = Dropout(p=dropout_ratio) if dropout_ratio > 0 else None
     self.fc = linear(w_out, num_classes, bias=True)
Esempio n. 2
0
 def __init__(self, w_in, head_width, num_classes):
     super(AnyHead, self).__init__()
     self.head_width = head_width
     if head_width > 0:
         self.conv = conv2d(w_in, head_width, 1)
         self.bn = norm2d(head_width)
         self.af = activation()
         w_in = head_width
     self.avg_pool = gap2d(w_in)
     self.fc = linear(w_in, num_classes, bias=True)
Esempio n. 3
0
 def __init__(self, w_in, mlp_d):
     super().__init__()
     self.linear_1 = linear(w_in, mlp_d, bias=True)
     self.af = activation("gelu")
     self.linear_2 = linear(mlp_d, w_in, bias=True)
Esempio n. 4
0
 def __init__(self, w_in, num_classes):
     super().__init__()
     self.head_fc = linear(w_in, num_classes, bias=True)
Esempio n. 5
0
 def __init__(self, w_in, num_classes):
     super(AnyHead, self).__init__()
     self.avg_pool = gap2d(w_in)
     self.fc = linear(w_in, num_classes, bias=True)