Deep learning 将ResNet50解码器代码转换为ResNet18解码器

Deep learning 将ResNet50解码器代码转换为ResNet18解码器,deep-learning,neural-network,pytorch,resnet,pre-trained-model,Deep Learning,Neural Network,Pytorch,Resnet,Pre Trained Model,我正在尝试从该存储库将U-Net模型的ResNet50编码器转换为ResNet18编码器。这对我来说都是新鲜事,我不明白为什么这样改变网络不起作用 self.bridge = Bridge(512, 512) up_blocks.append(UpBlockForUNetWithResNet50(512, 256)) up_blocks.append(UpBlockForUNetWithResNet50(256, 128)) up_blocks.append(UpBlockForUNetWit

我正在尝试从该存储库将U-Net模型的ResNet50编码器转换为ResNet18编码器。这对我来说都是新鲜事,我不明白为什么这样改变网络不起作用

self.bridge = Bridge(512, 512)

up_blocks.append(UpBlockForUNetWithResNet50(512, 256))
up_blocks.append(UpBlockForUNetWithResNet50(256, 128))
up_blocks.append(UpBlockForUNetWithResNet50(128,64))
收到的错误是:
给定的组=1,大小的权重[128,192,3,3],期望输入[2,256,64,64]有192个通道,但得到了256个通道。

resnet50
转换为
resnet18
是什么意思?网络具有特定的预训练权重,不能简单地转移到其他网络。预训练resnet50的解码器到预训练resnet18您想将预训练resnet18的编码器连接到预训练resnet50的解码器吗?我想更改代码以使用预训练resnet18而不是resnet50。基本上,我想为预先训练好的resnet18构建一个解码器,作为Unet的编码器。如果你能更连贯地解释你想要构建什么,这将是很有帮助的。如果我理解正确,您需要一个经过预训练的resnet18编码器。解码器中需要什么层?应该预先训练吗?如果是,来自哪种模式?