network = resnet34(pretrained=True)
self.x = nn.Sequential(*list(network.children())[4:5])
for name, layer in self.x.named_children():
layer[0].conv1=nn.Conv2d(64, 128, kernel_size=3, stride= 2, padding= 1, bias=False)
# 获取模型的参数字典network.conv1 = nn.Conv2d(3, 64, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3), bias=False)self.x1 = nn.Sequential(*list(network.children())[:3])self.x2 = nn.Sequential(*list(network.children())[3:5])self.x3 = nn.Sequential(*list(network.children())[5:6])self.x4 = nn.Sequential(*list(network.children())[6:7])self.x5 = nn.Sequential(*list(network.children())[7:8])