import torch.nn as nn
import torch.nn.functional as F
import math
import torch
__all__ = ["ResNet", 'resnet18', "resnet34", "resnet50", "resnet101", "resnet152"]
model_urls = {
"resnet18": 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'resnet101': 'https://download.pytorch.org/models/resnet101-5d3b4d8f.pth',
'resnet152': 'https://download.pytorch.org/models/resnet152-b121ed2d.pth',
}
def conv3x3(in_planes, out_plances, stride=1):
return nn.Con2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplances, planes, stride=1, downsample=None):
super(BasicBlock, self).__init__()
self.conv1 = conv3x3(inplaces, planes, stride)
self.bn1 = nn.BatchNorm2d(planes)
self.relu = nn.ReLU(inplace=True)
self.conv2 = conv3X3(planes, planes)
self.bn2 = nn.BatchNorm2d(planes)
self.downsample = downsample
self.stride = stride
def forward(self, x):
residual = x
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
if self.downsample is not None:
residual = self.downsample(x)
out += residual
out = self.relu(out)
return out
class Bottleneck(nn.Module):
print("Bottleneck:")
expansion = 4
def __init__(self, inplanes, planes, stride=1, downsample=None):
super(Bottleneck, self).__init__()
self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=1, bias=False)
self.bn1 = nn.BatchNorm2d(planes)
self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride,
padding=1, bias=False)
self.bn2 = nn.BatchNorm2d(planes)
self.conv3 = nn.Conv2d(planes, planes * 4, kernel_size=1, bias=False)
self.bn3 = nn.BatchNorm2d(planes * 4)
self.relu = nn.ReLU(inplace=True)
self.downsample = downsample
self.stride = stride
def forward(self, x):
residual = x
out = self.conv1(x)
out = self.bn1(out)
out = self.relu(out)
out = self.conv2(out)
out = self.bn2(out)
out = self.relu(out)
out = self.conv3(out)
out = self.bn3(out)
if self.downsample is not None:
residual = self.downsample(x)
out += residual
out = self.relu(out)
return out
class detnet_bottleneck(nn.Module):
expansion = 1
def __init__(self, in_planes, planes, stride=1, block_type='A'):
super(detnet_bottleneck, self).__init__()
self.conv1 = nn.Conv2d(in_planes, planes, kernel_size=1, bias=False)
self.bn1 = nn.BatchNorm2d(planes)
self.conv2 = nn.Conv2d(planes, planes, kernel_size=3, stride=stride, padding=2, bias=False, dilation=2)
self.bn2 = nn.BatchNorm2d(planes)
self.conv3 = nn.Conv2d(planes, self.expansion * planes, kernel_size=1, bias=False)
self.bn3 = nn.BatchNorm2d(self.expansion * planes)
self.downsample = nn.Sequential()
if stride != 1 or in_planes != self.expansion * planes or block_type == "B":
self.downsample = nn.Sequential(
nn.Conv2d(in_planes, self.expansion * planes, kernel_size=1, stride=stride, bias=False),
nn.BatchNorm2d(self.expansion * planes)
)
def forward(self, x):
out = F.relu(self.bn1(self.conv1(x)))
out = F.relu(self.bn2(self.conv2(out)))
out = self.bn3(self.conv3(out))
out += self.downsample(x)
out = F.relu(out)
return out
class ResNet(nn.Module):
def __init__(self, block, layers, num_classes=1470):
self.inplanes = 64
super(ResNet, self).__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=2, padding=3, bias=False)
self.bn1 = nn.BatchNorm2d(64)
self.relu = nn.ReLU(inplace=True)
self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
self.layer1 = self._make_layer(block, 64, layers[0])
self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
self.layer5 = self._make_detnet_layer(in_channels=2048)
# self.avgpool = nn.AvgPool2d(14) # fit 448 input size
#
# self.fc = nn.Linear(512 * block.expansion, num_classes)
self.conv_end = nn.Conv2d(256, 30, kernel_size=3, stride=1, padding=1, bias=False)
self.bn_end = nn.BatchNorm2d(30)
for m in self.modules(): # 遍历模型
if isinstance(m, nn.Conv2d): # isinstance : m类型判断 若当前组件为conv
n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels
m.weight.data.normal_(0, math.sqrt(2. / n)) # 正态分布初始化
elif isinstance(m, nn.BatchNorm2d): # 若为batchnorm
m.weight.data.fill_(1) # weight 为 1
m.bias.data.zero_() # bias 为0
def _make_layer(self, block, planes, blocks, stride=1):
downsample = None
if stride != 1 or self.inplanes != planes * block.expansion:
# 步长为2时,即第一次进入layer时,增加downsample层
# 或者inplanes 输入通道数,不等于block.expansion倍的planes=(输出通道数)
downsample = nn.Sequential(nn.Conv2d(self.inplanes, planes * block.expansion, kernel_size=1, stride=stride,
bias=False),
nn.BatchNorm2d(planes * block.expansion)
)
layers = []
layers.append(block(self.inplanes, planes, stride, downsample))
self.inplanes = planes * block.expansion
for i in range(1, blocks):
layers.append(block(self.inplanes, planes))
return nn.Sequential(*layers)
def _make_detnet_layer(self, in_channels):
layers = []
layers.append(detnet_bottleneck(in_planes=in_channels, planes=256, block_type="B"))
layers.append(detnet_bottleneck(in_planes=256, planes=256, block_type="A"))
layers.append(detnet_bottleneck(in_planes=256, planes=256, block_type="A"))
return nn.Sequential(*layers)
def forward(self, x):
x = self.conv1(x)
x = self.bn1(x)
x = self.relu(x)
x = self.maxpool(x)
x = self.layer1(x)
x = self.layer2(x)
x = self.layer3(x)
x = self.layer4(x)
x = self.layer5(x)
# x=self.avgpool(x)
# x=x.view(x.size(0),-1)
# x=self.fc(x)
x = self.conv_end(x)
x = self.bn_end(x)
# x=F.sigmoid(x) # 归一化 到0-1
x = torch.sigmoid(x)
# x=x.view(-1,7,7,30)
x = x.permute(0, 2, 3, 1) # (-1,7,7,30)
return x
def resnet18(pretrained=False, **kwargs):
model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls["resnet18"]))
return model
def resnet34(pretrained=False, **kwargs):
model = ResNet(BasicBlock, [3, 4, 6, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls["resnet34"]))
return model
def resnet50(pretrained=False, **kwargs):
model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)
print("I love china")
print(model)
input()
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls["resnet50"]))
return model
def resnet101(pretrained=False, **kwargs):
model = ResNet(Bottleneck, [3, 4, 23, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls["resnet101"]))
return model
def resnet152(pretrained=False, **kwargs):
model = ResNet(Bottleneck, [3, 8, 36, 3], **kwargs)
if pretrained:
model.load_state_dict(model_zoo.load_url(model_urls["resnet152"]))
return model
if __name__ == "__main__":
from torchsummary import summary
net = resnet50().cuda()
summary(net, (3, 418, 418))
print(net)
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 64, 209, 209] 9,408
BatchNorm2d-2 [-1, 64, 209, 209] 128
ReLU-3 [-1, 64, 209, 209] 0
MaxPool2d-4 [-1, 64, 105, 105] 0
Conv2d-5 [-1, 64, 105, 105] 4,096
BatchNorm2d-6 [-1, 64, 105, 105] 128
ReLU-7 [-1, 64, 105, 105] 0
Conv2d-8 [-1, 64, 105, 105] 36,864
BatchNorm2d-9 [-1, 64, 105, 105] 128
ReLU-10 [-1, 64, 105, 105] 0
Conv2d-11 [-1, 256, 105, 105] 16,384
BatchNorm2d-12 [-1, 256, 105, 105] 512
Conv2d-13 [-1, 256, 105, 105] 16,384
BatchNorm2d-14 [-1, 256, 105, 105] 512
ReLU-15 [-1, 256, 105, 105] 0
Bottleneck-16 [-1, 256, 105, 105] 0
Conv2d-17 [-1, 64, 105, 105] 16,384
BatchNorm2d-18 [-1, 64, 105, 105] 128
ReLU-19 [-1, 64, 105, 105] 0
Conv2d-20 [-1, 64, 105, 105] 36,864
BatchNorm2d-21 [-1, 64, 105, 105] 128
ReLU-22 [-1, 64, 105, 105] 0
Conv2d-23 [-1, 256, 105, 105] 16,384
BatchNorm2d-24 [-1, 256, 105, 105] 512
ReLU-25 [-1, 256, 105, 105] 0
Bottleneck-26 [-1, 256, 105, 105] 0
Conv2d-27 [-1, 64, 105, 105] 16,384
BatchNorm2d-28 [-1, 64, 105, 105] 128
ReLU-29 [-1, 64, 105, 105] 0
Conv2d-30 [-1, 64, 105, 105] 36,864
BatchNorm2d-31 [-1, 64, 105, 105] 128
ReLU-32 [-1, 64, 105, 105] 0
Conv2d-33 [-1, 256, 105, 105] 16,384
BatchNorm2d-34 [-1, 256, 105, 105] 512
ReLU-35 [-1, 256, 105, 105] 0
Bottleneck-36 [-1, 256, 105, 105] 0
Conv2d-37 [-1, 128, 105, 105] 32,768
BatchNorm2d-38 [-1, 128, 105, 105] 256
ReLU-39 [-1, 128, 105, 105] 0
Conv2d-40 [-1, 128, 53, 53] 147,456
BatchNorm2d-41 [-1, 128, 53, 53] 256
ReLU-42 [-1, 128, 53, 53] 0
Conv2d-43 [-1, 512, 53, 53] 65,536
BatchNorm2d-44 [-1, 512, 53, 53] 1,024
Conv2d-45 [-1, 512, 53, 53] 131,072
BatchNorm2d-46 [-1, 512, 53, 53] 1,024
ReLU-47 [-1, 512, 53, 53] 0
Bottleneck-48 [-1, 512, 53, 53] 0
Conv2d-49 [-1, 128, 53, 53] 65,536
BatchNorm2d-50 [-1, 128, 53, 53] 256
ReLU-51 [-1, 128, 53, 53] 0
Conv2d-52 [-1, 128, 53, 53] 147,456
BatchNorm2d-53 [-1, 128, 53, 53] 256
ReLU-54 [-1, 128, 53, 53] 0
Conv2d-55 [-1, 512, 53, 53] 65,536
BatchNorm2d-56 [-1, 512, 53, 53] 1,024
ReLU-57 [-1, 512, 53, 53] 0
Bottleneck-58 [-1, 512, 53, 53] 0
Conv2d-59 [-1, 128, 53, 53] 65,536
BatchNorm2d-60 [-1, 128, 53, 53] 256
ReLU-61 [-1, 128, 53, 53] 0
Conv2d-62 [-1, 128, 53, 53] 147,456
BatchNorm2d-63 [-1, 128, 53, 53] 256
ReLU-64 [-1, 128, 53, 53] 0
Conv2d-65 [-1, 512, 53, 53] 65,536
BatchNorm2d-66 [-1, 512, 53, 53] 1,024
ReLU-67 [-1, 512, 53, 53] 0
Bottleneck-68 [-1, 512, 53, 53] 0
Conv2d-69 [-1, 128, 53, 53] 65,536
BatchNorm2d-70 [-1, 128, 53, 53] 256
ReLU-71 [-1, 128, 53, 53] 0
Conv2d-72 [-1, 128, 53, 53] 147,456
BatchNorm2d-73 [-1, 128, 53, 53] 256
ReLU-74 [-1, 128, 53, 53] 0
Conv2d-75 [-1, 512, 53, 53] 65,536
BatchNorm2d-76 [-1, 512, 53, 53] 1,024
ReLU-77 [-1, 512, 53, 53] 0
Bottleneck-78 [-1, 512, 53, 53] 0
Conv2d-79 [-1, 256, 53, 53] 131,072
BatchNorm2d-80 [-1, 256, 53, 53] 512
ReLU-81 [-1, 256, 53, 53] 0
Conv2d-82 [-1, 256, 27, 27] 589,824
BatchNorm2d-83 [-1, 256, 27, 27] 512
ReLU-84 [-1, 256, 27, 27] 0
Conv2d-85 [-1, 1024, 27, 27] 262,144
BatchNorm2d-86 [-1, 1024, 27, 27] 2,048
Conv2d-87 [-1, 1024, 27, 27] 524,288
BatchNorm2d-88 [-1, 1024, 27, 27] 2,048
ReLU-89 [-1, 1024, 27, 27] 0
Bottleneck-90 [-1, 1024, 27, 27] 0
Conv2d-91 [-1, 256, 27, 27] 262,144
BatchNorm2d-92 [-1, 256, 27, 27] 512
ReLU-93 [-1, 256, 27, 27] 0
Conv2d-94 [-1, 256, 27, 27] 589,824
BatchNorm2d-95 [-1, 256, 27, 27] 512
ReLU-96 [-1, 256, 27, 27] 0
Conv2d-97 [-1, 1024, 27, 27] 262,144
BatchNorm2d-98 [-1, 1024, 27, 27] 2,048
ReLU-99 [-1, 1024, 27, 27] 0
Bottleneck-100 [-1, 1024, 27, 27] 0
Conv2d-101 [-1, 256, 27, 27] 262,144
BatchNorm2d-102 [-1, 256, 27, 27] 512
ReLU-103 [-1, 256, 27, 27] 0
Conv2d-104 [-1, 256, 27, 27] 589,824
BatchNorm2d-105 [-1, 256, 27, 27] 512
ReLU-106 [-1, 256, 27, 27] 0
Conv2d-107 [-1, 1024, 27, 27] 262,144
BatchNorm2d-108 [-1, 1024, 27, 27] 2,048
ReLU-109 [-1, 1024, 27, 27] 0
Bottleneck-110 [-1, 1024, 27, 27] 0
Conv2d-111 [-1, 256, 27, 27] 262,144
BatchNorm2d-112 [-1, 256, 27, 27] 512
ReLU-113 [-1, 256, 27, 27] 0
Conv2d-114 [-1, 256, 27, 27] 589,824
BatchNorm2d-115 [-1, 256, 27, 27] 512
ReLU-116 [-1, 256, 27, 27] 0
Conv2d-117 [-1, 1024, 27, 27] 262,144
BatchNorm2d-118 [-1, 1024, 27, 27] 2,048
ReLU-119 [-1, 1024, 27, 27] 0
Bottleneck-120 [-1, 1024, 27, 27] 0
Conv2d-121 [-1, 256, 27, 27] 262,144
BatchNorm2d-122 [-1, 256, 27, 27] 512
ReLU-123 [-1, 256, 27, 27] 0
Conv2d-124 [-1, 256, 27, 27] 589,824
BatchNorm2d-125 [-1, 256, 27, 27] 512
ReLU-126 [-1, 256, 27, 27] 0
Conv2d-127 [-1, 1024, 27, 27] 262,144
BatchNorm2d-128 [-1, 1024, 27, 27] 2,048
ReLU-129 [-1, 1024, 27, 27] 0
Bottleneck-130 [-1, 1024, 27, 27] 0
Conv2d-131 [-1, 256, 27, 27] 262,144
BatchNorm2d-132 [-1, 256, 27, 27] 512
ReLU-133 [-1, 256, 27, 27] 0
Conv2d-134 [-1, 256, 27, 27] 589,824
BatchNorm2d-135 [-1, 256, 27, 27] 512
ReLU-136 [-1, 256, 27, 27] 0
Conv2d-137 [-1, 1024, 27, 27] 262,144
BatchNorm2d-138 [-1, 1024, 27, 27] 2,048
ReLU-139 [-1, 1024, 27, 27] 0
Bottleneck-140 [-1, 1024, 27, 27] 0
Conv2d-141 [-1, 512, 27, 27] 524,288
BatchNorm2d-142 [-1, 512, 27, 27] 1,024
ReLU-143 [-1, 512, 27, 27] 0
Conv2d-144 [-1, 512, 14, 14] 2,359,296
BatchNorm2d-145 [-1, 512, 14, 14] 1,024
ReLU-146 [-1, 512, 14, 14] 0
Conv2d-147 [-1, 2048, 14, 14] 1,048,576
BatchNorm2d-148 [-1, 2048, 14, 14] 4,096
Conv2d-149 [-1, 2048, 14, 14] 2,097,152
BatchNorm2d-150 [-1, 2048, 14, 14] 4,096
ReLU-151 [-1, 2048, 14, 14] 0
Bottleneck-152 [-1, 2048, 14, 14] 0
Conv2d-153 [-1, 512, 14, 14] 1,048,576
BatchNorm2d-154 [-1, 512, 14, 14] 1,024
ReLU-155 [-1, 512, 14, 14] 0
Conv2d-156 [-1, 512, 14, 14] 2,359,296
BatchNorm2d-157 [-1, 512, 14, 14] 1,024
ReLU-158 [-1, 512, 14, 14] 0
Conv2d-159 [-1, 2048, 14, 14] 1,048,576
BatchNorm2d-160 [-1, 2048, 14, 14] 4,096
ReLU-161 [-1, 2048, 14, 14] 0
Bottleneck-162 [-1, 2048, 14, 14] 0
Conv2d-163 [-1, 512, 14, 14] 1,048,576
BatchNorm2d-164 [-1, 512, 14, 14] 1,024
ReLU-165 [-1, 512, 14, 14] 0
Conv2d-166 [-1, 512, 14, 14] 2,359,296
BatchNorm2d-167 [-1, 512, 14, 14] 1,024
ReLU-168 [-1, 512, 14, 14] 0
Conv2d-169 [-1, 2048, 14, 14] 1,048,576
BatchNorm2d-170 [-1, 2048, 14, 14] 4,096
ReLU-171 [-1, 2048, 14, 14] 0
Bottleneck-172 [-1, 2048, 14, 14] 0
Conv2d-173 [-1, 256, 14, 14] 524,288
BatchNorm2d-174 [-1, 256, 14, 14] 512
Conv2d-175 [-1, 256, 14, 14] 589,824
BatchNorm2d-176 [-1, 256, 14, 14] 512
Conv2d-177 [-1, 256, 14, 14] 65,536
BatchNorm2d-178 [-1, 256, 14, 14] 512
Conv2d-179 [-1, 256, 14, 14] 524,288
BatchNorm2d-180 [-1, 256, 14, 14] 512
detnet_bottleneck-181 [-1, 256, 14, 14] 0
Conv2d-182 [-1, 256, 14, 14] 65,536
BatchNorm2d-183 [-1, 256, 14, 14] 512
Conv2d-184 [-1, 256, 14, 14] 589,824
BatchNorm2d-185 [-1, 256, 14, 14] 512
Conv2d-186 [-1, 256, 14, 14] 65,536
BatchNorm2d-187 [-1, 256, 14, 14] 512
detnet_bottleneck-188 [-1, 256, 14, 14] 0
Conv2d-189 [-1, 256, 14, 14] 65,536
BatchNorm2d-190 [-1, 256, 14, 14] 512
Conv2d-191 [-1, 256, 14, 14] 589,824
BatchNorm2d-192 [-1, 256, 14, 14] 512
Conv2d-193 [-1, 256, 14, 14] 65,536
BatchNorm2d-194 [-1, 256, 14, 14] 512
detnet_bottleneck-195 [-1, 256, 14, 14] 0
Conv2d-196 [-1, 30, 14, 14] 69,120
BatchNorm2d-197 [-1, 30, 14, 14] 60
================================================================
Total params: 26,728,060
Trainable params: 26,728,060
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 2.00
Forward/backward pass size (MB): 1038.47
Params size (MB): 101.96
Estimated Total Size (MB): 1142.43
----------------------------------------------------------------
ResNet(
(conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(maxpool): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
(layer1): Sequential(
(0): Bottleneck(
(conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottleneck(
(conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottleneck(
(conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer2): Sequential(
(0): Bottleneck(
(conv1): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(256, 512, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottleneck(
(conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottleneck(
(conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(3): Bottleneck(
(conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer3): Sequential(
(0): Bottleneck(
(conv1): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(512, 1024, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottleneck(
(conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottleneck(
(conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(3): Bottleneck(
(conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(4): Bottleneck(
(conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(5): Bottleneck(
(conv1): Conv2d(1024, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer4): Sequential(
(0): Bottleneck(
(conv1): Conv2d(1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
(downsample): Sequential(
(0): Conv2d(1024, 2048, kernel_size=(1, 1), stride=(2, 2), bias=False)
(1): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): Bottleneck(
(conv1): Conv2d(2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
(2): Bottleneck(
(conv1): Conv2d(2048, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn2): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(512, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(relu): ReLU(inplace=True)
)
)
(layer5): Sequential(
(0): detnet_bottleneck(
(conv1): Conv2d(2048, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(downsample): Sequential(
(0): Conv2d(2048, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
)
(1): detnet_bottleneck(
(conv1): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(downsample): Sequential()
)
(2): detnet_bottleneck(
(conv1): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv2): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2), bias=False)
(bn2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(conv3): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
(bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(downsample): Sequential()
)
)
(conv_end): Conv2d(256, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
(bn_end): BatchNorm2d(30, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
)
Process finished with exit code 0