参考这个改的,检测开始收敛效果不是特别好
https://github.com/Alessiacosmos/Basic-RegNet-pytorch
# -*- encoding: utf-8 -*-
import time
import torch
import torch.nn as nn
# from utils.parse_cfg import load_cfg
class AnyStem(nn.Module):
"""AnyNet stem part"""
def __init__(self, w_in, w_out):
super(AnyStem, self).__init__()
self.conv = nn.Conv2d(w_in, w_out, kernel_size=7, stride=2, padding=3, bias=False)
self.bn = nn.BatchNorm2d(w_out, eps=1e-5, momentum=0.1)
self.relu = nn.ReLU(inplace=True)
self.pool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
def forward(self, x):
x = self.conv(x)
x = self.bn(x)
x = self.relu(x)
x = self.pool(x)
return x
class SE(nn.Module):