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>
pull/1/head
AlexWang1900 5 years ago committed by GitHub
parent 5414e53026
commit 4b074d9d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -61,3 +61,16 @@ class Mish(nn.Module): # https://github.com/digantamisra98/Mish
@staticmethod
def forward(x):
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…
Cancel
Save