Unverified 提交 4b074d9d authored 作者: AlexWang1900's avatar AlexWang1900 提交者: GitHub

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: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 5414e530
...@@ -61,3 +61,16 @@ class Mish(nn.Module): # https://github.com/digantamisra98/Mish ...@@ -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)))
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论