facebox retina
【摘要】
# coding:utf-8import timeimport torchimport torch.nn as nnimport torch.nn.functional as F class conv_bn_relu6(nn.Module): def __init__(self, nin, nout, kernel_siz...
-
# coding:utf-8
-
import time
-
import torch
-
import torch.nn as nn
-
import torch.nn.functional as F
-
-
-
-
class conv_bn_relu6(nn.Module):
-
def __init__(self, nin, nout, kernel_size, stride, padding, bias=False):
-
super(conv_bn_relu6, self).__init__()
-
self.conv = nn.Conv2d(nin, nout, kernel_size=kernel_size, stride=stride, padding=padding, bias=bias)
-
self.batch_norm = nn.BatchNorm2d(nout)
-
self.relu = nn.ReLU6(True)
-
# self.relu = mish.Mish()
-
-
def forward(self, x):
-
out = self.conv(x)
-
out = self.batch_norm(out)
-
out = self.relu(out)
-
-
return out
-
-
def conv_bn_relu(in_channels, out_channels, kernel_size, stride=1, padding=0):
-
m0 = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=padding, stride=stride)
-
-
m1 = nn.BatchNorm2d(out_channels)
-
-
return nn.Sequential(m0, m1, nn.ReLU6(True))
-
-
文章来源: blog.csdn.net,作者:AI视觉网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/104595935
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)