当前位置: 首页 > 工具软件 > Facebox > 使用案例 >

facebox retina

詹夕
2023-12-01

# 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))


 类似资料:

相关阅读

相关文章

相关问答