Funnel ReLU (FReLU) (#556)
* fix #541 #542 * Update train.py * Add Frelu * Update activations.py PEP8 and format updates for commonality with models.common.Conv() * Update activations.py Update case * Update activations.py Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
5414e53026
commit
4b074d9d9d
|
|
@ -61,3 +61,16 @@ class Mish(nn.Module): # https://github.com/digantamisra98/Mish
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def forward(x):
|
def forward(x):
|
||||||
return x * F.softplus(x).tanh()
|
return x * F.softplus(x).tanh()
|
||||||
|
|
||||||
|
|
||||||
|
# FReLU https://arxiv.org/abs/2007.11824 --------------------------------------
|
||||||
|
class FReLU(nn.Module):
|
||||||
|
def __init__(self, c1, k=3): # ch_in, kernel
|
||||||
|
super().__init()__()
|
||||||
|
self.conv = nn.Conv2d(c1, c1, k, 1, 1, groups=c1)
|
||||||
|
self.bn = nn.BatchNorm2d(c1)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def forward(self, x):
|
||||||
|
return torch.max(x, self.bn(self.conv(x)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue