1. 关于NCCL和cuda等
训练大型神经网络方法总结,地址:https://blog.csdn.net/xixiaoyaoww/article/details/104645796/
2. CPU和GPU运行的区别
详细:pytorch中model.to(device)和map_location=device的区别
3. 查看服务器GPU内存使用情况
地址:https://zhuanlan.zhihu.com/p/266586826
4. 目前遇到的问题是,用上次的软件看的节点不是代码里的形式,但是没找到有介绍每一个结点的文章,但如果不知道,就没办法在代码里使用。
对应遇到的bug是:KeyError。
文章:pytorch中保存的模型文件.pth深入解析
地址:https://blog.csdn.net/qq_27825451/article/details/100773473?utm_term=读取pth文件&utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~all~sobaiduweb~default-4-100773473&spm=3001.4430
参考文章后,加了一段代码查看.pth里的每一层节点,
代码如下:
代码语言:javascript复制#.pth预训练模型的认识
pthfile = r'/home/xx/CrowdDet/tools/data/model/rcnn_fpn_baseline.pth' #faster_rcnn_ckpt.pth
net = torch.load(pthfile, map_location=torch.device('cuda:0'))
#net = torch.load(pthfile,map_location=torch.device('cpu'))
print(type(net)) # 类型是 dict
print(len(net)) # 长度为 3,即存在3个 key-value 键值对
for k in net.keys():
print(k) # 查看3个键,分别是epoch,state_dict,optimizer
print('n')
# print(net["model"]) # 返回的是一个OrderedDict 对象
for key,value in net["state_dict"].items():
print(key,value.size(),sep=" ")
print('n' 'state_dict打印完毕' 'n')
最后shell里的输出是这样的:
代码语言:javascript复制<class 'dict'>
3
epoch
state_dict
optimizer
resnet50.conv1.weight torch.Size([64, 3, 7, 7])
resnet50.bn1.weight torch.Size([64])
resnet50.bn1.bias torch.Size([64])
resnet50.bn1.running_mean torch.Size([64])
resnet50.bn1.running_var torch.Size([64])
resnet50.layer1.0.downsample.0.weight torch.Size([256, 64, 1, 1])
resnet50.layer1.0.downsample.1.weight torch.Size([256])
resnet50.layer1.0.downsample.1.bias torch.Size([256])
resnet50.layer1.0.downsample.1.running_mean torch.Size([256])
resnet50.layer1.0.downsample.1.running_var torch.Size([256])
resnet50.layer1.0.conv1.weight torch.Size([64, 64, 1, 1])
resnet50.layer1.0.bn1.weight torch.Size([64])
resnet50.layer1.0.bn1.bias torch.Size([64])
resnet50.layer1.0.bn1.running_mean torch.Size([64])
resnet50.layer1.0.bn1.running_var torch.Size([64])
resnet50.layer1.0.conv2.weight torch.Size([64, 64, 3, 3])
resnet50.layer1.0.bn2.weight torch.Size([64])
resnet50.layer1.0.bn2.bias torch.Size([64])
resnet50.layer1.0.bn2.running_mean torch.Size([64])
resnet50.layer1.0.bn2.running_var torch.Size([64])
resnet50.layer1.0.conv3.weight torch.Size([256, 64, 1, 1])
resnet50.layer1.0.bn3.weight torch.Size([256])
resnet50.layer1.0.bn3.bias torch.Size([256])
resnet50.layer1.0.bn3.running_mean torch.Size([256])
resnet50.layer1.0.bn3.running_var torch.Size([256])
resnet50.layer1.1.conv1.weight torch.Size([64, 256, 1, 1])
resnet50.layer1.1.bn1.weight torch.Size([64])
resnet50.layer1.1.bn1.bias torch.Size([64])
resnet50.layer1.1.bn1.running_mean torch.Size([64])
resnet50.layer1.1.bn1.running_var torch.Size([64])
resnet50.layer1.1.conv2.weight torch.Size([64, 64, 3, 3])
resnet50.layer1.1.bn2.weight torch.Size([64])
resnet50.layer1.1.bn2.bias torch.Size([64])
resnet50.layer1.1.bn2.running_mean torch.Size([64])
resnet50.layer1.1.bn2.running_var torch.Size([64])
resnet50.layer1.1.conv3.weight torch.Size([256, 64, 1, 1])
resnet50.layer1.1.bn3.weight torch.Size([256])
resnet50.layer1.1.bn3.bias torch.Size([256])
resnet50.layer1.1.bn3.running_mean torch.Size([256])
resnet50.layer1.1.bn3.running_var torch.Size([256])
resnet50.layer1.2.conv1.weight torch.Size([64, 256, 1, 1])
resnet50.layer1.2.bn1.weight torch.Size([64])
resnet50.layer1.2.bn1.bias torch.Size([64])
resnet50.layer1.2.bn1.running_mean torch.Size([64])
resnet50.layer1.2.bn1.running_var torch.Size([64])
resnet50.layer1.2.conv2.weight torch.Size([64, 64, 3, 3])
resnet50.layer1.2.bn2.weight torch.Size([64])
resnet50.layer1.2.bn2.bias torch.Size([64])
resnet50.layer1.2.bn2.running_mean torch.Size([64])
resnet50.layer1.2.bn2.running_var torch.Size([64])
resnet50.layer1.2.conv3.weight torch.Size([256, 64, 1, 1])
resnet50.layer1.2.bn3.weight torch.Size([256])
resnet50.layer1.2.bn3.bias torch.Size([256])
resnet50.layer1.2.bn3.running_mean torch.Size([256])
resnet50.layer1.2.bn3.running_var torch.Size([256])
resnet50.layer2.0.downsample.0.weight torch.Size([512, 256, 1, 1])
resnet50.layer2.0.downsample.1.weight torch.Size([512])
resnet50.layer2.0.downsample.1.bias torch.Size([512])
resnet50.layer2.0.downsample.1.running_mean torch.Size([512])
resnet50.layer2.0.downsample.1.running_var torch.Size([512])
resnet50.layer2.0.conv1.weight torch.Size([128, 256, 1, 1])
resnet50.layer2.0.bn1.weight torch.Size([128])
resnet50.layer2.0.bn1.bias torch.Size([128])
resnet50.layer2.0.bn1.running_mean torch.Size([128])
resnet50.layer2.0.bn1.running_var torch.Size([128])
resnet50.layer2.0.conv2.weight torch.Size([128, 128, 3, 3])
resnet50.layer2.0.bn2.weight torch.Size([128])
resnet50.layer2.0.bn2.bias torch.Size([128])
resnet50.layer2.0.bn2.running_mean torch.Size([128])
resnet50.layer2.0.bn2.running_var torch.Size([128])
resnet50.layer2.0.conv3.weight torch.Size([512, 128, 1, 1])
resnet50.layer2.0.bn3.weight torch.Size([512])
resnet50.layer2.0.bn3.bias torch.Size([512])
resnet50.layer2.0.bn3.running_mean torch.Size([512])
resnet50.layer2.0.bn3.running_var torch.Size([512])
resnet50.layer2.1.conv1.weight torch.Size([128, 512, 1, 1])
resnet50.layer2.1.bn1.weight torch.Size([128])
resnet50.layer2.1.bn1.bias torch.Size([128])
resnet50.layer2.1.bn1.running_mean torch.Size([128])
resnet50.layer2.1.bn1.running_var torch.Size([128])
resnet50.layer2.1.conv2.weight torch.Size([128, 128, 3, 3])
resnet50.layer2.1.bn2.weight torch.Size([128])
resnet50.layer2.1.bn2.bias torch.Size([128])
resnet50.layer2.1.bn2.running_mean torch.Size([128])
resnet50.layer2.1.bn2.running_var torch.Size([128])
resnet50.layer2.1.conv3.weight torch.Size([512, 128, 1, 1])
resnet50.layer2.1.bn3.weight torch.Size([512])
resnet50.layer2.1.bn3.bias torch.Size([512])
resnet50.layer2.1.bn3.running_mean torch.Size([512])
resnet50.layer2.1.bn3.running_var torch.Size([512])
resnet50.layer2.2.conv1.weight torch.Size([128, 512, 1, 1])
resnet50.layer2.2.bn1.weight torch.Size([128])
resnet50.layer2.2.bn1.bias torch.Size([128])
resnet50.layer2.2.bn1.running_mean torch.Size([128])
resnet50.layer2.2.bn1.running_var torch.Size([128])
resnet50.layer2.2.conv2.weight torch.Size([128, 128, 3, 3])
resnet50.layer2.2.bn2.weight torch.Size([128])
resnet50.layer2.2.bn2.bias torch.Size([128])
resnet50.layer2.2.bn2.running_mean torch.Size([128])
resnet50.layer2.2.bn2.running_var torch.Size([128])
resnet50.layer2.2.conv3.weight torch.Size([512, 128, 1, 1])
resnet50.layer2.2.bn3.weight torch.Size([512])
resnet50.layer2.2.bn3.bias torch.Size([512])
resnet50.layer2.2.bn3.running_mean torch.Size([512])
resnet50.layer2.2.bn3.running_var torch.Size([512])
resnet50.layer2.3.conv1.weight torch.Size([128, 512, 1, 1])
resnet50.layer2.3.bn1.weight torch.Size([128])
resnet50.layer2.3.bn1.bias torch.Size([128])
resnet50.layer2.3.bn1.running_mean torch.Size([128])
resnet50.layer2.3.bn1.running_var torch.Size([128])
resnet50.layer2.3.conv2.weight torch.Size([128, 128, 3, 3])
resnet50.layer2.3.bn2.weight torch.Size([128])
resnet50.layer2.3.bn2.bias torch.Size([128])
resnet50.layer2.3.bn2.running_mean torch.Size([128])
resnet50.layer2.3.bn2.running_var torch.Size([128])
resnet50.layer2.3.conv3.weight torch.Size([512, 128, 1, 1])
resnet50.layer2.3.bn3.weight torch.Size([512])
resnet50.layer2.3.bn3.bias torch.Size([512])
resnet50.layer2.3.bn3.running_mean torch.Size([512])
resnet50.layer2.3.bn3.running_var torch.Size([512])
resnet50.layer3.0.downsample.0.weight torch.Size([1024, 512, 1, 1])
resnet50.layer3.0.downsample.1.weight torch.Size([1024])
resnet50.layer3.0.downsample.1.bias torch.Size([1024])
resnet50.layer3.0.downsample.1.running_mean torch.Size([1024])
resnet50.layer3.0.downsample.1.running_var torch.Size([1024])
resnet50.layer3.0.conv1.weight torch.Size([256, 512, 1, 1])
resnet50.layer3.0.bn1.weight torch.Size([256])
resnet50.layer3.0.bn1.bias torch.Size([256])
resnet50.layer3.0.bn1.running_mean torch.Size([256])
resnet50.layer3.0.bn1.running_var torch.Size([256])
resnet50.layer3.0.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.0.bn2.weight torch.Size([256])
resnet50.layer3.0.bn2.bias torch.Size([256])
resnet50.layer3.0.bn2.running_mean torch.Size([256])
resnet50.layer3.0.bn2.running_var torch.Size([256])
resnet50.layer3.0.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.0.bn3.weight torch.Size([1024])
resnet50.layer3.0.bn3.bias torch.Size([1024])
resnet50.layer3.0.bn3.running_mean torch.Size([1024])
resnet50.layer3.0.bn3.running_var torch.Size([1024])
resnet50.layer3.1.conv1.weight torch.Size([256, 1024, 1, 1])
resnet50.layer3.1.bn1.weight torch.Size([256])
resnet50.layer3.1.bn1.bias torch.Size([256])
resnet50.layer3.1.bn1.running_mean torch.Size([256])
resnet50.layer3.1.bn1.running_var torch.Size([256])
resnet50.layer3.1.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.1.bn2.weight torch.Size([256])
resnet50.layer3.1.bn2.bias torch.Size([256])
resnet50.layer3.1.bn2.running_mean torch.Size([256])
resnet50.layer3.1.bn2.running_var torch.Size([256])
resnet50.layer3.1.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.1.bn3.weight torch.Size([1024])
resnet50.layer3.1.bn3.bias torch.Size([1024])
resnet50.layer3.1.bn3.running_mean torch.Size([1024])
resnet50.layer3.1.bn3.running_var torch.Size([1024])
resnet50.layer3.2.conv1.weight torch.Size([256, 1024, 1, 1])
resnet50.layer3.2.bn1.weight torch.Size([256])
resnet50.layer3.2.bn1.bias torch.Size([256])
resnet50.layer3.2.bn1.running_mean torch.Size([256])
resnet50.layer3.2.bn1.running_var torch.Size([256])
resnet50.layer3.2.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.2.bn2.weight torch.Size([256])
resnet50.layer3.2.bn2.bias torch.Size([256])
resnet50.layer3.2.bn2.running_mean torch.Size([256])
resnet50.layer3.2.bn2.running_var torch.Size([256])
resnet50.layer3.2.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.2.bn3.weight torch.Size([1024])
resnet50.layer3.2.bn3.bias torch.Size([1024])
resnet50.layer3.2.bn3.running_mean torch.Size([1024])
resnet50.layer3.2.bn3.running_var torch.Size([1024])
resnet50.layer3.3.conv1.weight torch.Size([256, 1024, 1, 1])
resnet50.layer3.3.bn1.weight torch.Size([256])
resnet50.layer3.3.bn1.bias torch.Size([256])
resnet50.layer3.3.bn1.running_mean torch.Size([256])
resnet50.layer3.3.bn1.running_var torch.Size([256])
resnet50.layer3.3.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.3.bn2.weight torch.Size([256])
resnet50.layer3.3.bn2.bias torch.Size([256])
resnet50.layer3.3.bn2.running_mean torch.Size([256])
resnet50.layer3.3.bn2.running_var torch.Size([256])
resnet50.layer3.3.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.3.bn3.weight torch.Size([1024])
resnet50.layer3.3.bn3.bias torch.Size([1024])
resnet50.layer3.3.bn3.running_mean torch.Size([1024])
resnet50.layer3.3.bn3.running_var torch.Size([1024])
resnet50.layer3.4.conv1.weight torch.Size([256, 1024, 1, 1])
resnet50.layer3.4.bn1.weight torch.Size([256])
resnet50.layer3.4.bn1.bias torch.Size([256])
resnet50.layer3.4.bn1.running_mean torch.Size([256])
resnet50.layer3.4.bn1.running_var torch.Size([256])
resnet50.layer3.4.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.4.bn2.weight torch.Size([256])
resnet50.layer3.4.bn2.bias torch.Size([256])
resnet50.layer3.4.bn2.running_mean torch.Size([256])
resnet50.layer3.4.bn2.running_var torch.Size([256])
resnet50.layer3.4.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.4.bn3.weight torch.Size([1024])
resnet50.layer3.4.bn3.bias torch.Size([1024])
resnet50.layer3.4.bn3.running_mean torch.Size([1024])
resnet50.layer3.4.bn3.running_var torch.Size([1024])
resnet50.layer3.5.conv1.weight torch.Size([256, 1024, 1, 1])
resnet50.layer3.5.bn1.weight torch.Size([256])
resnet50.layer3.5.bn1.bias torch.Size([256])
resnet50.layer3.5.bn1.running_mean torch.Size([256])
resnet50.layer3.5.bn1.running_var torch.Size([256])
resnet50.layer3.5.conv2.weight torch.Size([256, 256, 3, 3])
resnet50.layer3.5.bn2.weight torch.Size([256])
resnet50.layer3.5.bn2.bias torch.Size([256])
resnet50.layer3.5.bn2.running_mean torch.Size([256])
resnet50.layer3.5.bn2.running_var torch.Size([256])
resnet50.layer3.5.conv3.weight torch.Size([1024, 256, 1, 1])
resnet50.layer3.5.bn3.weight torch.Size([1024])
resnet50.layer3.5.bn3.bias torch.Size([1024])
resnet50.layer3.5.bn3.running_mean torch.Size([1024])
resnet50.layer3.5.bn3.running_var torch.Size([1024])
resnet50.layer4.0.downsample.0.weight torch.Size([2048, 1024, 1, 1])
resnet50.layer4.0.downsample.1.weight torch.Size([2048])
resnet50.layer4.0.downsample.1.bias torch.Size([2048])
resnet50.layer4.0.downsample.1.running_mean torch.Size([2048])
resnet50.layer4.0.downsample.1.running_var torch.Size([2048])
resnet50.layer4.0.conv1.weight torch.Size([512, 1024, 1, 1])
resnet50.layer4.0.bn1.weight torch.Size([512])
resnet50.layer4.0.bn1.bias torch.Size([512])
resnet50.layer4.0.bn1.running_mean torch.Size([512])
resnet50.layer4.0.bn1.running_var torch.Size([512])
resnet50.layer4.0.conv2.weight torch.Size([512, 512, 3, 3])
resnet50.layer4.0.bn2.weight torch.Size([512])
resnet50.layer4.0.bn2.bias torch.Size([512])
resnet50.layer4.0.bn2.running_mean torch.Size([512])
resnet50.layer4.0.bn2.running_var torch.Size([512])
resnet50.layer4.0.conv3.weight torch.Size([2048, 512, 1, 1])
resnet50.layer4.0.bn3.weight torch.Size([2048])
resnet50.layer4.0.bn3.bias torch.Size([2048])
resnet50.layer4.0.bn3.running_mean torch.Size([2048])
resnet50.layer4.0.bn3.running_var torch.Size([2048])
resnet50.layer4.1.conv1.weight torch.Size([512, 2048, 1, 1])
resnet50.layer4.1.bn1.weight torch.Size([512])
resnet50.layer4.1.bn1.bias torch.Size([512])
resnet50.layer4.1.bn1.running_mean torch.Size([512])
resnet50.layer4.1.bn1.running_var torch.Size([512])
resnet50.layer4.1.conv2.weight torch.Size([512, 512, 3, 3])
resnet50.layer4.1.bn2.weight torch.Size([512])
resnet50.layer4.1.bn2.bias torch.Size([512])
resnet50.layer4.1.bn2.running_mean torch.Size([512])
resnet50.layer4.1.bn2.running_var torch.Size([512])
resnet50.layer4.1.conv3.weight torch.Size([2048, 512, 1, 1])
resnet50.layer4.1.bn3.weight torch.Size([2048])
resnet50.layer4.1.bn3.bias torch.Size([2048])
resnet50.layer4.1.bn3.running_mean torch.Size([2048])
resnet50.layer4.1.bn3.running_var torch.Size([2048])
resnet50.layer4.2.conv1.weight torch.Size([512, 2048, 1, 1])
resnet50.layer4.2.bn1.weight torch.Size([512])
resnet50.layer4.2.bn1.bias torch.Size([512])
resnet50.layer4.2.bn1.running_mean torch.Size([512])
resnet50.layer4.2.bn1.running_var torch.Size([512])
resnet50.layer4.2.conv2.weight torch.Size([512, 512, 3, 3])
resnet50.layer4.2.bn2.weight torch.Size([512])
resnet50.layer4.2.bn2.bias torch.Size([512])
resnet50.layer4.2.bn2.running_mean torch.Size([512])
resnet50.layer4.2.bn2.running_var torch.Size([512])
resnet50.layer4.2.conv3.weight torch.Size([2048, 512, 1, 1])
resnet50.layer4.2.bn3.weight torch.Size([2048])
resnet50.layer4.2.bn3.bias torch.Size([2048])
resnet50.layer4.2.bn3.running_mean torch.Size([2048])
resnet50.layer4.2.bn3.running_var torch.Size([2048])
FPN.lateral_convs.0.weight torch.Size([256, 2048, 1, 1])
FPN.lateral_convs.0.bias torch.Size([256])
FPN.lateral_convs.1.weight torch.Size([256, 1024, 1, 1])
FPN.lateral_convs.1.bias torch.Size([256])
FPN.lateral_convs.2.weight torch.Size([256, 512, 1, 1])
FPN.lateral_convs.2.bias torch.Size([256])
FPN.lateral_convs.3.weight torch.Size([256, 256, 1, 1])
FPN.lateral_convs.3.bias torch.Size([256])
FPN.output_convs.0.weight torch.Size([256, 256, 3, 3])
FPN.output_convs.0.bias torch.Size([256])
FPN.output_convs.1.weight torch.Size([256, 256, 3, 3])
FPN.output_convs.1.bias torch.Size([256])
FPN.output_convs.2.weight torch.Size([256, 256, 3, 3])
FPN.output_convs.2.bias torch.Size([256])
FPN.output_convs.3.weight torch.Size([256, 256, 3, 3])
FPN.output_convs.3.bias torch.Size([256])
FPN.bottom_up.conv1.weight torch.Size([64, 3, 7, 7])
FPN.bottom_up.bn1.weight torch.Size([64])
FPN.bottom_up.bn1.bias torch.Size([64])
FPN.bottom_up.bn1.running_mean torch.Size([64])
FPN.bottom_up.bn1.running_var torch.Size([64])
FPN.bottom_up.layer1.0.downsample.0.weight torch.Size([256, 64, 1, 1])
FPN.bottom_up.layer1.0.downsample.1.weight torch.Size([256])
FPN.bottom_up.layer1.0.downsample.1.bias torch.Size([256])
FPN.bottom_up.layer1.0.downsample.1.running_mean torch.Size([256])
FPN.bottom_up.layer1.0.downsample.1.running_var torch.Size([256])
FPN.bottom_up.layer1.0.conv1.weight torch.Size([64, 64, 1, 1])
FPN.bottom_up.layer1.0.bn1.weight torch.Size([64])
FPN.bottom_up.layer1.0.bn1.bias torch.Size([64])
FPN.bottom_up.layer1.0.bn1.running_mean torch.Size([64])
FPN.bottom_up.layer1.0.bn1.running_var torch.Size([64])
FPN.bottom_up.layer1.0.conv2.weight torch.Size([64, 64, 3, 3])
FPN.bottom_up.layer1.0.bn2.weight torch.Size([64])
FPN.bottom_up.layer1.0.bn2.bias torch.Size([64])
FPN.bottom_up.layer1.0.bn2.running_mean torch.Size([64])
FPN.bottom_up.layer1.0.bn2.running_var torch.Size([64])
FPN.bottom_up.layer1.0.conv3.weight torch.Size([256, 64, 1, 1])
FPN.bottom_up.layer1.0.bn3.weight torch.Size([256])
FPN.bottom_up.layer1.0.bn3.bias torch.Size([256])
FPN.bottom_up.layer1.0.bn3.running_mean torch.Size([256])
FPN.bottom_up.layer1.0.bn3.running_var torch.Size([256])
FPN.bottom_up.layer1.1.conv1.weight torch.Size([64, 256, 1, 1])
FPN.bottom_up.layer1.1.bn1.weight torch.Size([64])
FPN.bottom_up.layer1.1.bn1.bias torch.Size([64])
FPN.bottom_up.layer1.1.bn1.running_mean torch.Size([64])
FPN.bottom_up.layer1.1.bn1.running_var torch.Size([64])
FPN.bottom_up.layer1.1.conv2.weight torch.Size([64, 64, 3, 3])
FPN.bottom_up.layer1.1.bn2.weight torch.Size([64])
FPN.bottom_up.layer1.1.bn2.bias torch.Size([64])
FPN.bottom_up.layer1.1.bn2.running_mean torch.Size([64])
FPN.bottom_up.layer1.1.bn2.running_var torch.Size([64])
FPN.bottom_up.layer1.1.conv3.weight torch.Size([256, 64, 1, 1])
FPN.bottom_up.layer1.1.bn3.weight torch.Size([256])
FPN.bottom_up.layer1.1.bn3.bias torch.Size([256])
FPN.bottom_up.layer1.1.bn3.running_mean torch.Size([256])
FPN.bottom_up.layer1.1.bn3.running_var torch.Size([256])
FPN.bottom_up.layer1.2.conv1.weight torch.Size([64, 256, 1, 1])
FPN.bottom_up.layer1.2.bn1.weight torch.Size([64])
FPN.bottom_up.layer1.2.bn1.bias torch.Size([64])
FPN.bottom_up.layer1.2.bn1.running_mean torch.Size([64])
FPN.bottom_up.layer1.2.bn1.running_var torch.Size([64])
FPN.bottom_up.layer1.2.conv2.weight torch.Size([64, 64, 3, 3])
FPN.bottom_up.layer1.2.bn2.weight torch.Size([64])
FPN.bottom_up.layer1.2.bn2.bias torch.Size([64])
FPN.bottom_up.layer1.2.bn2.running_mean torch.Size([64])
FPN.bottom_up.layer1.2.bn2.running_var torch.Size([64])
FPN.bottom_up.layer1.2.conv3.weight torch.Size([256, 64, 1, 1])
FPN.bottom_up.layer1.2.bn3.weight torch.Size([256])
FPN.bottom_up.layer1.2.bn3.bias torch.Size([256])
FPN.bottom_up.layer1.2.bn3.running_mean torch.Size([256])
FPN.bottom_up.layer1.2.bn3.running_var torch.Size([256])
FPN.bottom_up.layer2.0.downsample.0.weight torch.Size([512, 256, 1, 1])
FPN.bottom_up.layer2.0.downsample.1.weight torch.Size([512])
FPN.bottom_up.layer2.0.downsample.1.bias torch.Size([512])
FPN.bottom_up.layer2.0.downsample.1.running_mean torch.Size([512])
FPN.bottom_up.layer2.0.downsample.1.running_var torch.Size([512])
FPN.bottom_up.layer2.0.conv1.weight torch.Size([128, 256, 1, 1])
FPN.bottom_up.layer2.0.bn1.weight torch.Size([128])
FPN.bottom_up.layer2.0.bn1.bias torch.Size([128])
FPN.bottom_up.layer2.0.bn1.running_mean torch.Size([128])
FPN.bottom_up.layer2.0.bn1.running_var torch.Size([128])
FPN.bottom_up.layer2.0.conv2.weight torch.Size([128, 128, 3, 3])
FPN.bottom_up.layer2.0.bn2.weight torch.Size([128])
FPN.bottom_up.layer2.0.bn2.bias torch.Size([128])
FPN.bottom_up.layer2.0.bn2.running_mean torch.Size([128])
FPN.bottom_up.layer2.0.bn2.running_var torch.Size([128])
FPN.bottom_up.layer2.0.conv3.weight torch.Size([512, 128, 1, 1])
FPN.bottom_up.layer2.0.bn3.weight torch.Size([512])
FPN.bottom_up.layer2.0.bn3.bias torch.Size([512])
FPN.bottom_up.layer2.0.bn3.running_mean torch.Size([512])
FPN.bottom_up.layer2.0.bn3.running_var torch.Size([512])
FPN.bottom_up.layer2.1.conv1.weight torch.Size([128, 512, 1, 1])
FPN.bottom_up.layer2.1.bn1.weight torch.Size([128])
FPN.bottom_up.layer2.1.bn1.bias torch.Size([128])
FPN.bottom_up.layer2.1.bn1.running_mean torch.Size([128])
FPN.bottom_up.layer2.1.bn1.running_var torch.Size([128])
FPN.bottom_up.layer2.1.conv2.weight torch.Size([128, 128, 3, 3])
FPN.bottom_up.layer2.1.bn2.weight torch.Size([128])
FPN.bottom_up.layer2.1.bn2.bias torch.Size([128])
FPN.bottom_up.layer2.1.bn2.running_mean torch.Size([128])
FPN.bottom_up.layer2.1.bn2.running_var torch.Size([128])
FPN.bottom_up.layer2.1.conv3.weight torch.Size([512, 128, 1, 1])
FPN.bottom_up.layer2.1.bn3.weight torch.Size([512])
FPN.bottom_up.layer2.1.bn3.bias torch.Size([512])
FPN.bottom_up.layer2.1.bn3.running_mean torch.Size([512])
FPN.bottom_up.layer2.1.bn3.running_var torch.Size([512])
FPN.bottom_up.layer2.2.conv1.weight torch.Size([128, 512, 1, 1])
FPN.bottom_up.layer2.2.bn1.weight torch.Size([128])
FPN.bottom_up.layer2.2.bn1.bias torch.Size([128])
FPN.bottom_up.layer2.2.bn1.running_mean torch.Size([128])
FPN.bottom_up.layer2.2.bn1.running_var torch.Size([128])
FPN.bottom_up.layer2.2.conv2.weight torch.Size([128, 128, 3, 3])
FPN.bottom_up.layer2.2.bn2.weight torch.Size([128])
FPN.bottom_up.layer2.2.bn2.bias torch.Size([128])
FPN.bottom_up.layer2.2.bn2.running_mean torch.Size([128])
FPN.bottom_up.layer2.2.bn2.running_var torch.Size([128])
FPN.bottom_up.layer2.2.conv3.weight torch.Size([512, 128, 1, 1])
FPN.bottom_up.layer2.2.bn3.weight torch.Size([512])
FPN.bottom_up.layer2.2.bn3.bias torch.Size([512])
FPN.bottom_up.layer2.2.bn3.running_mean torch.Size([512])
FPN.bottom_up.layer2.2.bn3.running_var torch.Size([512])
FPN.bottom_up.layer2.3.conv1.weight torch.Size([128, 512, 1, 1])
FPN.bottom_up.layer2.3.bn1.weight torch.Size([128])
FPN.bottom_up.layer2.3.bn1.bias torch.Size([128])
FPN.bottom_up.layer2.3.bn1.running_mean torch.Size([128])
FPN.bottom_up.layer2.3.bn1.running_var torch.Size([128])
FPN.bottom_up.layer2.3.conv2.weight torch.Size([128, 128, 3, 3])
FPN.bottom_up.layer2.3.bn2.weight torch.Size([128])
FPN.bottom_up.layer2.3.bn2.bias torch.Size([128])
FPN.bottom_up.layer2.3.bn2.running_mean torch.Size([128])
FPN.bottom_up.layer2.3.bn2.running_var torch.Size([128])
FPN.bottom_up.layer2.3.conv3.weight torch.Size([512, 128, 1, 1])
FPN.bottom_up.layer2.3.bn3.weight torch.Size([512])
FPN.bottom_up.layer2.3.bn3.bias torch.Size([512])
FPN.bottom_up.layer2.3.bn3.running_mean torch.Size([512])
FPN.bottom_up.layer2.3.bn3.running_var torch.Size([512])
FPN.bottom_up.layer3.0.downsample.0.weight torch.Size([1024, 512, 1, 1])
FPN.bottom_up.layer3.0.downsample.1.weight torch.Size([1024])
FPN.bottom_up.layer3.0.downsample.1.bias torch.Size([1024])
FPN.bottom_up.layer3.0.downsample.1.running_mean torch.Size([1024])
FPN.bottom_up.layer3.0.downsample.1.running_var torch.Size([1024])
FPN.bottom_up.layer3.0.conv1.weight torch.Size([256, 512, 1, 1])
FPN.bottom_up.layer3.0.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.0.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.0.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.0.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.0.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.0.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.0.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.0.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.0.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.0.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.0.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.0.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.0.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.0.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer3.1.conv1.weight torch.Size([256, 1024, 1, 1])
FPN.bottom_up.layer3.1.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.1.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.1.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.1.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.1.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.1.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.1.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.1.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.1.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.1.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.1.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.1.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.1.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.1.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer3.2.conv1.weight torch.Size([256, 1024, 1, 1])
FPN.bottom_up.layer3.2.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.2.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.2.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.2.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.2.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.2.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.2.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.2.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.2.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.2.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.2.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.2.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.2.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.2.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer3.3.conv1.weight torch.Size([256, 1024, 1, 1])
FPN.bottom_up.layer3.3.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.3.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.3.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.3.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.3.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.3.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.3.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.3.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.3.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.3.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.3.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.3.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.3.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.3.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer3.4.conv1.weight torch.Size([256, 1024, 1, 1])
FPN.bottom_up.layer3.4.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.4.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.4.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.4.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.4.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.4.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.4.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.4.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.4.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.4.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.4.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.4.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.4.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.4.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer3.5.conv1.weight torch.Size([256, 1024, 1, 1])
FPN.bottom_up.layer3.5.bn1.weight torch.Size([256])
FPN.bottom_up.layer3.5.bn1.bias torch.Size([256])
FPN.bottom_up.layer3.5.bn1.running_mean torch.Size([256])
FPN.bottom_up.layer3.5.bn1.running_var torch.Size([256])
FPN.bottom_up.layer3.5.conv2.weight torch.Size([256, 256, 3, 3])
FPN.bottom_up.layer3.5.bn2.weight torch.Size([256])
FPN.bottom_up.layer3.5.bn2.bias torch.Size([256])
FPN.bottom_up.layer3.5.bn2.running_mean torch.Size([256])
FPN.bottom_up.layer3.5.bn2.running_var torch.Size([256])
FPN.bottom_up.layer3.5.conv3.weight torch.Size([1024, 256, 1, 1])
FPN.bottom_up.layer3.5.bn3.weight torch.Size([1024])
FPN.bottom_up.layer3.5.bn3.bias torch.Size([1024])
FPN.bottom_up.layer3.5.bn3.running_mean torch.Size([1024])
FPN.bottom_up.layer3.5.bn3.running_var torch.Size([1024])
FPN.bottom_up.layer4.0.downsample.0.weight torch.Size([2048, 1024, 1, 1])
FPN.bottom_up.layer4.0.downsample.1.weight torch.Size([2048])
FPN.bottom_up.layer4.0.downsample.1.bias torch.Size([2048])
FPN.bottom_up.layer4.0.downsample.1.running_mean torch.Size([2048])
FPN.bottom_up.layer4.0.downsample.1.running_var torch.Size([2048])
FPN.bottom_up.layer4.0.conv1.weight torch.Size([512, 1024, 1, 1])
FPN.bottom_up.layer4.0.bn1.weight torch.Size([512])
FPN.bottom_up.layer4.0.bn1.bias torch.Size([512])
FPN.bottom_up.layer4.0.bn1.running_mean torch.Size([512])
FPN.bottom_up.layer4.0.bn1.running_var torch.Size([512])
FPN.bottom_up.layer4.0.conv2.weight torch.Size([512, 512, 3, 3])
FPN.bottom_up.layer4.0.bn2.weight torch.Size([512])
FPN.bottom_up.layer4.0.bn2.bias torch.Size([512])
FPN.bottom_up.layer4.0.bn2.running_mean torch.Size([512])
FPN.bottom_up.layer4.0.bn2.running_var torch.Size([512])
FPN.bottom_up.layer4.0.conv3.weight torch.Size([2048, 512, 1, 1])
FPN.bottom_up.layer4.0.bn3.weight torch.Size([2048])
FPN.bottom_up.layer4.0.bn3.bias torch.Size([2048])
FPN.bottom_up.layer4.0.bn3.running_mean torch.Size([2048])
FPN.bottom_up.layer4.0.bn3.running_var torch.Size([2048])
FPN.bottom_up.layer4.1.conv1.weight torch.Size([512, 2048, 1, 1])
FPN.bottom_up.layer4.1.bn1.weight torch.Size([512])
FPN.bottom_up.layer4.1.bn1.bias torch.Size([512])
FPN.bottom_up.layer4.1.bn1.running_mean torch.Size([512])
FPN.bottom_up.layer4.1.bn1.running_var torch.Size([512])
FPN.bottom_up.layer4.1.conv2.weight torch.Size([512, 512, 3, 3])
FPN.bottom_up.layer4.1.bn2.weight torch.Size([512])
FPN.bottom_up.layer4.1.bn2.bias torch.Size([512])
FPN.bottom_up.layer4.1.bn2.running_mean torch.Size([512])
FPN.bottom_up.layer4.1.bn2.running_var torch.Size([512])
FPN.bottom_up.layer4.1.conv3.weight torch.Size([2048, 512, 1, 1])
FPN.bottom_up.layer4.1.bn3.weight torch.Size([2048])
FPN.bottom_up.layer4.1.bn3.bias torch.Size([2048])
FPN.bottom_up.layer4.1.bn3.running_mean torch.Size([2048])
FPN.bottom_up.layer4.1.bn3.running_var torch.Size([2048])
FPN.bottom_up.layer4.2.conv1.weight torch.Size([512, 2048, 1, 1])
FPN.bottom_up.layer4.2.bn1.weight torch.Size([512])
FPN.bottom_up.layer4.2.bn1.bias torch.Size([512])
FPN.bottom_up.layer4.2.bn1.running_mean torch.Size([512])
FPN.bottom_up.layer4.2.bn1.running_var torch.Size([512])
FPN.bottom_up.layer4.2.conv2.weight torch.Size([512, 512, 3, 3])
FPN.bottom_up.layer4.2.bn2.weight torch.Size([512])
FPN.bottom_up.layer4.2.bn2.bias torch.Size([512])
FPN.bottom_up.layer4.2.bn2.running_mean torch.Size([512])
FPN.bottom_up.layer4.2.bn2.running_var torch.Size([512])
FPN.bottom_up.layer4.2.conv3.weight torch.Size([2048, 512, 1, 1])
FPN.bottom_up.layer4.2.bn3.weight torch.Size([2048])
FPN.bottom_up.layer4.2.bn3.bias torch.Size([2048])
FPN.bottom_up.layer4.2.bn3.running_mean torch.Size([2048])
FPN.bottom_up.layer4.2.bn3.running_var torch.Size([2048])
RPN.rpn_conv.weight torch.Size([256, 256, 3, 3])
RPN.rpn_conv.bias torch.Size([256])
RPN.rpn_cls_score.weight torch.Size([6, 256, 1, 1])
RPN.rpn_cls_score.bias torch.Size([6])
RPN.rpn_bbox_offsets.weight torch.Size([12, 256, 1, 1])
RPN.rpn_bbox_offsets.bias torch.Size([12])
RCNN.fc1.weight torch.Size([1024, 12544])
RCNN.fc1.bias torch.Size([1024])
RCNN.fc2.weight torch.Size([1024, 1024])
RCNN.fc2.bias torch.Size([1024])
RCNN.pred_cls.weight torch.Size([2, 1024])
RCNN.pred_cls.bias torch.Size([2])
RCNN.pred_delta.weight torch.Size([8, 1024])
RCNN.pred_delta.bias torch.Size([8])
state_dict打印完毕
目前存在的问题是,不知道为什么
del backbone_dict['state_dict']['fc.weight']
代码是错误的,报错是KeyError。
改了一下代码,变成del backbone_dict['state_dict']['RCNN.fc1.weight']之后就不报错了,但是打印之后发现没变化,是del只是暂时删除吗?还是没明白源代码是想要删除什么,就不知道怎么改代码比较好....
5.