接ssd的,收敛比较慢
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class Flatten(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x.view(x.data.size(0),-1)
class CombConvLayer(nn.Sequential):
def __init__(self, in_channels, out_channels, kernel=1, stride=1, dropout=0.1, bias=False):
super().__init__()
self.add_module('layer1',ConvLayer(in_channels, out_channels, kernel))
self.add_module('layer2',DWConvLayer(out_channels, out_channels, stride=stride))
def forward(self, x):
return super().forward(x)
class DWConvLayer(nn.Sequential):
def __init__(self, in_channels, out_channels, stride=1, bias=False):
super().__init__()