Skip to content

Commit 4b074d9

Browse files
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>
1 parent 5414e53 commit 4b074d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

utils/activations.py

+13
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,16 @@ class Mish(nn.Module): # https://github.com/digantamisra98/Mish
6161
@staticmethod
6262
def forward(x):
6363
return x * F.softplus(x).tanh()
64+
65+
66+
# FReLU https://arxiv.org/abs/2007.11824 --------------------------------------
67+
class FReLU(nn.Module):
68+
def __init__(self, c1, k=3): # ch_in, kernel
69+
super().__init()__()
70+
self.conv = nn.Conv2d(c1, c1, k, 1, 1, groups=c1)
71+
self.bn = nn.BatchNorm2d(c1)
72+
73+
@staticmethod
74+
def forward(self, x):
75+
return torch.max(x, self.bn(self.conv(x)))
76+

0 commit comments

Comments
 (0)